Tom Lane <tgl@sss.pgh.pa.us> writes:
> I think we can still file this as a compiler bug, because I'm pretty sure
> the C spec does not allow rearrangement of floating-point calculations ...
It may have more to do with whether the floating point value can stay in a
floating point register long enough to complete the calculation.
IIRC, floating point registers are actually longer than a double so if the
entire calculation is done in registers and then the result rounded off to
store in memory it may get the right answer. Whereas if it loses the extra
bits on the intermediate values (the infinite repeating fractions) that might
be where you get the imprecise results.
It makes some sense that -mcpu and -march give the compiler enough information
to keep the intermediate results in registers more effectively.
--
greg