public void TwoProductPre2Split_Random() { // Just checks that the result from 2-pre-split is same as 2xSplit + TwoProduct var rnd = new RandomDouble(2); // Use a specific seed to ensure repeatability int testCount = 100000; for (int i = 0; i < testCount; i++) { double a = rnd.NextDoubleValidRange(); double b = rnd.NextDoubleValidRange(); double x; double y; TwoProduct_Checked(a, b, out x, out y); double ahi, alo; EA.Split(a, out ahi, out alo); double bhi, blo; EA.Split(b, out bhi, out blo); double xps, yps; EA.TwoProduct2Presplit(a, ahi, alo, b, bhi, blo, out xps, out yps); NUnit.Framework.Assert.AreEqual(x, xps); NUnit.Framework.Assert.AreEqual(y, yps); } Debug.Print("TwoProduct_Random Tested {0} tries", testCount); }
public void TwoProduct_Random() { var rnd = new RandomDouble(3); // Use a specific seed to ensure repeatability int testCount = 100000; for (int i = 0; i < testCount; i++) { double a = rnd.NextDoubleValidRange(); double b = rnd.NextDoubleValidRange(); double x; double y; TwoProduct_Checked(a, b, out x, out y); } Debug.Print("TwoProduct_Random Tested {0} tries", testCount); }
public void Square_Random() { var rnd = new RandomDouble(3); // Use a specific seed to ensure repeatability int testCount = 100000; for (int i = 0; i < testCount; i++) { double a = rnd.NextDoubleValidRange(); double xp, yp; EA.TwoProduct(a, a, out xp, out yp); double xs, ys; EA.Square(a, out xs, out ys); NUnit.Framework.Assert.AreEqual(xp, xs); NUnit.Framework.Assert.AreEqual(yp, ys); } }