Rounding errors using doubles?
Dima Volodin
dvv@dvv.ru
Wed Mar 31 23:46:00 GMT 1999
Sam Lantinga wrote:
> I have to thank everyone here on this list for your responsiveness.
> The problem was caused by unexpected values in code using doubles
> that was ported from Windows. Apparently, by default, Windows uses
> 53 bits of precision for it's double operations. Linux uses 64 bits.
>
> Since the code relies on the exact behavior of doubles quite extensively,
> we are setting the precision of the FPU to 53 bits using the fldcw
> instruction. :)
>
> BTW, does anyone know what precision is used on the PPC and Alpha
> architectures?
Man, I'm telling you - your code is _broken_. It's just sheer luck you see it
working at all.
> -Sam Lantinga (slouken@devolution.com)
Dima
More information about the Gcc
mailing list