GNU GCC does not round floating-point divisions to the nearest value
Conversation
Replying to
I assume this is 32b only, because the compiler is faithfully modeling the x87 extended-precision arithmetic (FLT_EVAL_METHOD=2) of the runtime environment.
2
E.g. if you tell it to use SSE for fp, or compile for 64b, I would expect to see the "right" result.
2
The difference with Clang is that it assumes SSE support by default and refuses to use x87 floating point if SSE is supported. If you pass -mfpmath=387 -mno-sse to Clang, it will work the same way as GCC does by default. If you don't pass -mno-sse, it refuses to use x87 support.
So the line “fesetround(FE_TONEAREST);” is just for show, right? There is no guarantee at all that the compiler will honour it? So why is it not “trysetround(FE_TONEAREST);” or something?
1
Show replies


