Subject Re[2]: [ib-support] Wierd math???
Author Daniel Rail

> Joe,
> Nando and Martijn raise valid points about floating point math and
> database storage issues.

> However, I agree that in your particular situation, one should at the very
> minimum get
> some value just slightly off 0 (since with so few values, you couldn't get
> that much
> accumulated rounding error).

If you read the value properly, it is slightly off 0.

Take into account the exponential value of -16 and the value would
translate into: 0.00000000000000085348.....

> So I took a quick sec to run a test. I created a dummy table with an int
> field and
> a double-precision field (all you gave in your explanation), populated it
> with your given
> data, along with some interspersed records with key <> 5, and then ran your
> query. It gives
> the expected 0.00 result, no rounding error at all.
> That leads me to believe that your problem isn't weird math,
> but something else pertaining to indexes or corruption or some other thing.
> You should probably
> do a similar test yourself in a new dummy database to see if you get the
> screwy result or not.

It could also depend on the processor of the computer and the OS.
And, how the rounding of float values are handled, by either one of

> If you don't get the error, I'd try backing up and restoring the db...

Anything can possibly help in finding the cause when you're unsure
what the exact cause of the problem is.

Daniel Rail
Senior System Engineer
ACCRA Group Inc. (
ACCRA Med Software Inc. (