public void TestPSinCorrectness() { for (int i = 1; i < 100; i++) { double mySin = ParallelMath.PSin(i, 1E-9, 2); double mathSin = Math.Sin(i); Assert.IsTrue(Math.Abs(mySin - mathSin) <= 1E-9); } }
public void TestPSinSpeeed() { Stopwatch sw = new Stopwatch(); Stopwatch pSw = new Stopwatch(); double res; sw.Start(); for (int i = 1; i < 100; i++) { res = ParallelMath.Sin(i, 1E-20); } sw.Stop(); pSw.Start(); for (int i = 1; i < 100; i++) { res = ParallelMath.PSin(i, 1E-20, 4); } pSw.Stop(); Assert.IsTrue(pSw.ElapsedTicks < sw.ElapsedTicks); }