http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48937

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-09 
17:57:00 UTC ---
To add to Jonathan's comment:
32 bit x86 (i686, IA-32) systems can do calculations in the mathematical
coprocessor (x87); this processor calculates internally with 80 bit variables
thus as long as a variable remains in the register, you are actually
calculating with 80 bits instead of 32 bit (single) or 64 (double precision).

A proper IEEE 754 however ensures that no excess precision occurs, which
happens for instance with SSE, which is used under 64bit x86-64 (AMD64,
Intel64) by default. Usually, one does not want to have the excess precision as
it is unpredictable. If the variable is stored in between in the memory, the
extra precision is lost. "-ffloat-store" does so, which is one way to get to
more deterministic results by never using the excess precision. Another means
is to use -mfpmath=sse also under 32bit.

If the precision is not enough, you can go the a higher precision for all
variables; gfortran supports 32, 64, 80 and 128 bit precision via the data
types REAL(4), REAL(8), REAL(10) and REAL(16). - If you change the the real
type, remember to also update the literal constants.

Further reference:
- http://gcc.gnu.org/wiki/x87note
- http://www.validlab.com/goldberg/paper.pdf
- http://hal.archives-ouvertes.fr/hal-00128124

PS: GCC's C/C++ compiler also supports -fexcess-precision=standard, which GCC's
Fortran compiler doesn't.

Reply via email to