[Sc-devel] -0 bug
Ryan Brown
ryan at wabdo.com
Mon Jan 28 01:16:33 PST 2008
> as Brian W. has mentioned before, there is a bug where:
>
> 0.0 * -1.0
>
> returns -0.
-0.0 is part of the floating point spec and should be allowed in SC.
The original issue that was brought up with (60.0 % 12) returning -0.0
on PPC and 0.0 on i386 is a bug though. I spent a while trying to
figure out why this is...and I have no idea. Some kind of bizarre
floating point error. Just putting this line before sc_mod returns
will fix the problem on PPC:
fprintf(stderr, "sc_mod dbl: %f", hi*floor(in/hi));
Using fmod rather than sc_mod also fixes it, and this is what we
should probably do.
Ryan
More information about the Sc-devel
mailing list