[plt-scheme] fix for (sin 12345678901234567890123)
So, on c.l.s. it has been indirectly pointed out that (sin
12345678901234567890123) obeys the following curious invariant in MzScheme
202 on Windows:
(define oleg-num 12345678901234567890123)
(eqv? (exact->inexact oleg-num) (sin oleg-num)) => #t
With Microsoft's C compiler, the problem seems to be caused by use of the
/O2 compiler option. The c.l.s. thread and my latest message there gives
more detail.
This might be fixable for PLT Scheme's Windows version by checking whether
Visual Studio 6.0 Service Pack 3 fixes it, per
http://support.microsoft.com/default.aspx?scid=KB;en-us;q217033, which seems
related. I haven't tested this myself.
If that doesn't fix it, then turning off global optimizations (/Og-) in the
appropriate places will definitely fix it. mzscheme/src/number.c would be
one such place. Global optimizations can also be disabled with #pragmas in
the code - putting pragmas around the GEN_UNARY_OP definitions for sin_prim
et al did indeed fix the problem, but of course other floating-point code
may be affected.
Anton