The Museum of HP Calculators

HP Forum Archive 19

[ Return to Index | Top of Index ]

Rounding errors
Message #1 Posted by BruceH on 21 Nov 2009, 11:08 a.m.

Just to emphasise that rounding errors aren't just limited to calculators here's something culled from the Interweb...

Quote:
There are mutterings about Motorola doing an unannounced, covert update on their Droid camera because so many people are reporting that the autofocus, which has been a bit rubbish, is now suddenly working.

The actual situation is (I think) quite funny.

Android Engineer, Dan Morrill said: There's a rounding-error bug in the camera driver's autofocus routine (which uses a timestamp) that causes autofocus to behave poorly on a 24.5-day cycle. That is, it'll work for 24.5 days, then have poor performance for 24.5 days, then work again. The 17th is the start of a new "works correctly" cycle, so the devices will be fine for a while. A permanent fix is in the works.


      
Re: Rounding errors
Message #2 Posted by Lyuka on 21 Nov 2009, 12:00 p.m.,
in response to message #1 by BruceH

24.5 days means 2^31 [ms]

It is probably an old singed and unsigned or wrap-round bug but not rounding errors.

The source or related article is Slashdot IT Story

            
Re: Rounding errors
Message #3 Posted by Paul Dale on 21 Nov 2009, 5:27 p.m.,
in response to message #2 by Lyuka

So it isn't so much a rounding error as an integer overflow.

Still, I cannot fathom a reason why the autofocus code would care about the time. Especially at this level of accuracy -- maybe at the hour mark to attempt to judge day and night but not at the ms level.

- Pauli

                  
Re: Rounding errors
Message #4 Posted by David Hayden on 22 Nov 2009, 10:41 a.m.,
in response to message #3 by Paul Dale

Quote:
Still, I cannot fathom a reason why the autofocus code would care about the time. Especially at this level of accuracy -- maybe at the hour mark to attempt to judge day and night but not at the ms level.

I have minimal knowledge of how autofocus works, but that never stopped me from speculating before.... :)

The routine might do something like this:

- Check to focus
- Move the focus knob for a little while.
- Recheck the focus.
- If you've passed the focus point, then interpolate based on how
  long you were turning the knob and go back accordingly.
Now if you get the time from a millisecond counter and mistakenly interpret it as a signed value, you'll think that the time interval was negative and all hell breaks loose.

Again, this is purely speculation, but I think it illustrates how time might factor into their calculations.

                        
Re: Rounding errors
Message #5 Posted by Vieira, Luiz C. (Brazil) on 22 Nov 2009, 11:24 a.m.,
in response to message #4 by David Hayden

Quote:
Now if you get the time from a millisecond counter and mistakenly interpret it as a signed value, you'll think that the time interval was negative and all hell breaks loose.
In this case, we actually have an algorithmic error.

Luiz (Brazil)


[ Return to Index | Top of Index ]

Go back to the main exhibit hall