Re: set the precision of Intel's FPU.

Jim Wilson <[email protected]> 03 Dec 2002 17:24:35 -0500
Newsgroups gmane.linux.redhat.ia64.general
Message-ID <[email protected]>
The x86 gcc port suffers from the "excess precision" problem.  This is partly
a problem of the design of the x86 FPU, and partly a problem of the design of
the gcc x86 port.  The result is that FP programs sometimes give different
and/or incorrect results.  (The m68k has the same problem, but few people
use it anymore for FP.)

The IA-64 gcc port does not suffer from any such problem.

With the x86 gcc port, you can avoid most but not all "excess precision"
problems by setting the precision to double.  This should work if your program
only uses 64-bit doubles.  If your program uses 32-bit floats, then you still
have excess precision problems (intermediate calculations on floats are done
in double instead of in float as expected).  A better solution is to use the
SSE registers for all FP, since the SSE registers support actual 32-bit and
64-bit FP operations.  However, this requires very recent processors and
very recent gcc versions, and may not be reliable enough for production use
yet, so it is probably not an easy solution.

Jim