HP Forums

Full Version: Rounding errors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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.


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

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

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.

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)