|
|
|
@ -300,6 +300,27 @@ type public BigRationalTests() = |
|
|
|
//let powers = [0I .. 100I] |
|
|
|
//powers |> List.iter (fun i -> test1All "PowN(x,i)" (fun x -> BigRational.PowN(x,int i)) (fun (p,q) -> (BigInteger.Pow(p,i),BigInteger.Pow(q,i))) vector1s) |
|
|
|
|
|
|
|
[<Test>] |
|
|
|
member this.FromDecimal() = |
|
|
|
let pairs = |
|
|
|
[ |
|
|
|
1M, 1N |
|
|
|
100000000000000M, 100000000000000N |
|
|
|
10000000000000000000000000000M, 10000000000000000000000000000N |
|
|
|
100000000000000.00000000000000M, 100000000000000N |
|
|
|
1.0000000000000000000000000000M, 1N |
|
|
|
123456789M, 123456789N |
|
|
|
0.123456789M, 123456789N/1000000000N |
|
|
|
0.000000000123456789M, 123456789N/1000000000000000000N |
|
|
|
0.000000000000000000123456789M, 123456789N/1000000000000000000000000000N |
|
|
|
4294967295M, 4294967295N |
|
|
|
18446744073709551615M, 18446744073709551615N |
|
|
|
Decimal.MaxValue, 79228162514264337593543950335N |
|
|
|
Decimal.MinValue, -79228162514264337593543950335N |
|
|
|
-7.9228162514264337593543950335M, -79228162514264337593543950335N/10000000000000000000000000000N |
|
|
|
] |
|
|
|
for (decimal, rational) in pairs do |
|
|
|
Assert.AreEqual(rational, BigRational.FromDecimal(decimal)) |
|
|
|
|
|
|
|
|
|
|
|
[<TestFixture>] |
|
|
|
|