diff options
| author | Sébastien d'Herbais de Thun <sebastien.d.herbais@gmail.com> | 2024-01-12 14:38:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-12 13:38:58 +0000 |
| commit | 1834ebc52918754dee51afffd8b55e82613eb687 (patch) | |
| tree | 9fbffc2634472811ce914279e4b433606a7900ec /tests/typ | |
| parent | c298cf61f2360eac0ec6a260fad11425b405f49f (diff) | |
Added `int.signum`, `float.signum`, `float.is-nan`, and `float.is-infinite` (#3118)
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/compute/calc.typ | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/typ/compute/calc.typ b/tests/typ/compute/calc.typ index e61e15d4..68f76b39 100644 --- a/tests/typ/compute/calc.typ +++ b/tests/typ/compute/calc.typ @@ -20,6 +20,35 @@ #test(type(float(10)), float) --- +// Test float `is-nan()`. +#test(float(calc.nan).is-nan(), true) +#test(float(10).is-nan(), false) + +--- +// Test float `is-infinite()`. +#test(float(calc.inf).is-infinite(), true) +#test(float(-calc.inf).is-infinite(), true) +#test(float(10).is-infinite(), false) +#test(float(-10).is-infinite(), false) + +--- +// Test float `signum()` +#test(float(0.0).signum(), 1.0) +#test(float(1.0).signum(), 1.0) +#test(float(-1.0).signum(), -1.0) +#test(float(10.0).signum(), 1.0) +#test(float(-10.0).signum(), -1.0) +#test(float(calc.nan).signum().is-nan(), true) + +--- +// Test int `signum()` +#test(int(0).signum(), 0) +#test(int(1.0).signum(), 1) +#test(int(-1.0).signum(), -1) +#test(int(10.0).signum(), 1) +#test(int(-10.0).signum(), -1) + +--- #test(calc.round(calc.e, digits: 2), 2.72) #test(calc.round(calc.pi, digits: 2), 3.14) |
