Next: , Previous: Large File Unit Numbers, Up: Working Programs

14.4.10 Floating-point precision

If your program depends on exact IEEE 754 floating-point handling it may help on some systems—specifically x86 or m68k hardware—to use the -ffloat-store option or to reset the precision flag on the floating-point unit. See Optimize Options.

However, it might be better simply to put the FPU into double precision mode and not take the performance hit of -ffloat-store. On x86 and m68k GNU systems you can do this with a technique similar to that for turning on floating-point exceptions (see Floating-point Exception Handling). The control word could be set to double precision by some code like this one:

     #include <fpu_control.h>
       fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE;

(It is not clear whether this has any effect on the operation of the GNU maths library, but we have no evidence of it causing trouble.)

Some targets (such as the Alpha) may need special options for full IEEE conformance. See Hardware Models and Configurations.