On Tue, 03 Jun 2008 15:14:52 -0500, Razii <kl*****@mail.c omwrote:
>The answer I get from C# is: 0.8582721324763 73
with Java I get 0.8582727931702 359
Checking the answer with maple, I get
0.858272793170 235835523886390 848406646600203 4
How are you going to fix C# in this case?
Does it bother you that C# gave wrong answer?
Console.WriteLi ne(Math.Sin (1e7));
0.4205477931907 71 (C# with .NET)
0.4205477931907 824912985065897 4095 (right answer)
Console.WriteLi ne(Math.Sin (1e10));
-0.4875060250762 7 (C# with .NET)
-0.4875060250875 106915277942943 4811 (right answer)
Console.WriteLi ne(Math.Sin (1e15));
0.8582721324763 73 (C# with .NET)
0.8582727931702 358355238863908 484 (right answer)
So C# doesn't get 15-17 digit accuracy of double for sin and cos.
That's the only reason it's faster in partialsums benchmark. By using
FastMath class, the times for both is about same on my computer.
On the other hand, you still need to 'optimize' 4 benchmarks where
..NET is much slower: binarytrees, sum-col, recursive, revcomp.