Tried this in snippet compiler, because I was worried about the error.
DateTime start = DateTime.Now;
WL("Math.Sin(10000) = {0}", Math.Sin(10000));
TimeSpan ts = DateTime.Now - start;
WL("Time Taken: {0}", ts);
DateTime start2 = DateTime.Now;
WL("Math.Sin(Math.IEEERemainder(10000, 2*Math.PI)) = {0}",
Math.Sin(Math.IEEERemainder(10000, 2*Math.PI)));
TimeSpan ts2 = DateTime.Now - start2;
WL("Time Taken: {0}", ts2);
RL();
Out:
Math.Sin(10000) = -0.305614388888252
Time Taken: 00:00:00
Math.Sin(Math.IEEERemainder(10000, 2*Math.PI)) = -0.305614388888028
Time Taken: 00:00:00
Math.Sin(1000000) = -0.349993502171292
Time Taken: 00:00:00
Math.Sin(Math.IEEERemainder(1000000, 2*Math.PI)) = -0.349993502093929
Time Taken: 00:00:00
There seems to be a increasing error as the number gets bigger. The
error may be too high to be acceptable in your situation.
I'm not seeing this slowness problem though. May be I need to run it
1000 times.
jliu
johnliu.net