diff options
| author | Emanuel <emanuel@empa.xyz> | 2023-12-06 14:32:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-06 14:32:56 +0100 |
| commit | 9e333e5058f54703fa9be0f34914061be6c8a272 (patch) | |
| tree | 6f518fc246e4ffb91e0dfb35fd0e107a79bdf9dd /tests | |
| parent | 9a62b21a25cd9a56090e0bf1afecfa3888d810d8 (diff) | |
Add calc.root function (#2736)
Fixes #2522
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/compute/calc.typ | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/typ/compute/calc.typ b/tests/typ/compute/calc.typ index 86dcafcd..e61e15d4 100644 --- a/tests/typ/compute/calc.typ +++ b/tests/typ/compute/calc.typ @@ -163,6 +163,22 @@ #calc.sqrt(-1) --- +#test(calc.root(12.0, 1), 12.0) +#test(calc.root(9.0, 2), 3.0) +#test(calc.root(27.0, 3), 3.0) +#test(calc.root(-27.0, 3), -3.0) +// 100^(-1/2) = (100^(1/2))^-1 = 1/sqrt(100) +#test(calc.root(100.0, -2), 0.1) + +--- +// Error: 17-18 cannot take the 0th root of a number +#calc.root(1.0, 0) + +--- +// Error: 24-25 negative numbers do not have a real nth root when n is even +#test(calc.root(-27.0, 4), -3.0) + +--- // Error: 11-13 value must be strictly positive #calc.log(-1) |
