The perennial i386 floating-point rounding issue...

Joseph S. Myers jsm28@cam.ac.uk
Fri Jun 7 17:52:00 GMT 2002


On Sat, 8 Jun 2002, Fergus Henderson wrote:

> local variables would change spontaneously.  But using extended precision
> for intermediate expression results is fine, because this is permitted
> by the C standard's abstract semantics:
> 
>  |        5.2.4.2.2  Characteristics of floating types <float.h>
>  | 
>  |        [#7] The values of operations  with  floating  operands  and
>  |        values  subject  to  the usual arithmetic conversions and of
>  |        floating constants are evaluated to a format whose range and
>  |        precision may be greater than required by the type.

Only as long as we set FLT_EVAL_METHOD properly.  It ought to be -1 if
intermediate values might or might not be 80-bit depending on whether
spilled, but 2 (which it is at present) only if all intermediate
calculations are genuinely 80-bit.  (And maybe something else again if
using SSE for floating point.  The i386 back end needs to define
__FLT_EVAL_METHOD to the right value depending on all these factors, and
the header should then #define FTL_EVAL_METHOD __FLT_EVAL_METHOD.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc mailing list