diff --git a/src/stdlib/WebSharper.MathJS/Main.fs b/src/stdlib/WebSharper.MathJS/Main.fs index 5c46d648..30ee8769 100644 --- a/src/stdlib/WebSharper.MathJS/Main.fs +++ b/src/stdlib/WebSharper.MathJS/Main.fs @@ -143,6 +143,7 @@ module Definition = [| BaseNumber.Type T + T T Unit.Type |] @@ -158,6 +159,7 @@ module Definition = [| BaseNumber.Type T + T T Unit.Type |] diff --git a/tests/WebSharper.Tests/MathJS.fs b/tests/WebSharper.Tests/MathJS.fs index 19a34cc2..c8be1d35 100644 --- a/tests/WebSharper.Tests/MathJS.fs +++ b/tests/WebSharper.Tests/MathJS.fs @@ -43,6 +43,9 @@ let Tests runServerSide = equalMsg (MathJS.Math.Add(1., 2., 3.)) 6. "MathJS.Math.Add(1., 2., 3.) = 6" } + Test "MathJS add (decimal)" { + equalMsg (MathJS.Math.Add(1.0m, 0.1m, 2.0m, 0.2m)) 3.3m "MathJS.Math.Add(1.0m, 0.1m, 2.0m, 0.2m) = 3.3m" + } Test "MathJS add (fraction)" { let a = MathJS.Math.Fraction(0.1) @@ -288,6 +291,12 @@ let Tests runServerSide = equal (floor x) 18133887298m } + Test "MathJS.Math.Round" { + let x = 18133887298.441562272235520m + equal (MathJS.Math.Round(x, 0m)) 18133887298m + equal (MathJS.Math.Round(x, 2m)) 18133887298.44m + } + Test "Decimal comparison" { let x = 18133887298.441562272235520m let y = 18133887298.441562272237357m