public bool Test_Divide_1(Tuple <ulong, ulong, ulong, ulong> a) { var m0 = a.Item1; var m1 = a.Item2; var n0 = a.Item3; var n1 = a.Item4; if (0 == n0 && 0 == n1) { try { var d0 = DoubleArithmetic.Divide(m0, m1, n0, n1, out UInt64 d1); return(false); } catch (DivideByZeroException) { return(true); } } else { var d0 = DoubleArithmetic.Divide(m0, m1, n0, n1, out UInt64 d1); var m = UInt64ArrayToBigIntegerUnsigned(m0, m1); var n = UInt64ArrayToBigIntegerUnsigned(n0, n1); var p = m / n; var d = UInt64ArrayToBigIntegerUnsigned(d0, d1); return(p == d); } }
public void Test_Divide_1() { var run_count = 1000000; Func <Tuple <ulong, ulong, ulong, ulong>, bool> predicate = (a) => { var m0 = a.Item1; var m1 = a.Item2; var n0 = a.Item3; var n1 = a.Item4; if (0 == n0 && 0 == n1) { try { var d0 = DoubleArithmetic.Divide(m0, m1, n0, n1, out UInt64 d1); return(false); } catch (DivideByZeroException) { return(true); } } else { var d0 = DoubleArithmetic.Divide(m0, m1, n0, n1, out UInt64 d1); var m = UInt64ArrayToBigIntegerUnsigned(m0, m1); var n = UInt64ArrayToBigIntegerUnsigned(n0, n1); var p = m / n; var d = UInt64ArrayToBigIntegerUnsigned(d0, d1); return(p == d); } }; FsCheck.Prop.ForAll(predicate).Check(new Configuration() { MaxNbOfTest = run_count }); return; }