Re: Floating point problems (accuracy).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Phil,

>Does any one know a better way of fixing this? ... Is there a generic solution?

There are several different strategies for addressing this kind of problem. What's "The Best" strategy? Depends on your needs.

Some of the strategies:

1. hardware differences mean that different architectures may be inconsistent with the less signficant bits (aka "the fiddly bits"). Expect that to be the case, and live with it.

2. use strict IEEE 754 compliance throughout your program -- this does put a considerable burden on the developers

3. avoid floating point; use fixed point or just integers for all your calculations (this is The Answer if you absolutely MUST have the same result on all platforms)

4. use software floating point (e.g., -msoft-float) -- be aware of the significant performance penalty

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux