public double RunDoubleDouble(int nIter) { var sw = new Stopwatch(); sw.Start(); for (int i = 0; i < nIter; i++) { var a = new DD(9.0); var factor = new DD(10.0); var aMul = factor.Multiply(a); var aDiv = a.Divide(factor); var det = a.Multiply(a) .Subtract(aMul.Multiply(aDiv)); // Console.WriteLine(aDiv); // Console.WriteLine(det); } sw.Stop(); Console.WriteLine("DD: nIter = " + nIter + " time = " + sw.ElapsedMilliseconds); return(sw.ElapsedMilliseconds / (double)nIter); }
private static void CheckDivideMultiply(DD a, DD b, double errBound) { DD a2 = a.Divide(b).Multiply(b); CheckErrorBound("DivideMultiply", a, a2, errBound); }
public double RunDoubleDouble(int nIter) { Stopwatch sw = new Stopwatch(); sw.Start(); for (int i = 0; i < nIter; i++) { DD a = new DD(9.0); DD factor = new DD(10.0); DD aMul = factor.Multiply(a); DD aDiv = a.Divide(factor); DD det = a.Multiply(a) .Subtract(aMul.Multiply(aDiv)); // Console.WriteLine(aDiv); // Console.WriteLine(det); } sw.Stop(); Console.WriteLine("DD: nIter = " + nIter + " time = " + sw.ElapsedMilliseconds); return sw.ElapsedMilliseconds/(double) nIter; }