www.delorie.com/gnu/docs/gcc/g77_563.html   search  
 
Buy the book!


Using and Porting GNU Fortran

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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 section 5.7 Options That Control Optimization.

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 section 15.3.29 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;
  _FPU_SETCW(cw);
}
(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 section `Hardware Models and Configurations' in Using the GNU Compiler Collection (GCC).


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003