diff options
| author | HydroH <ixlesis@gmail.com> | 2024-10-31 20:41:50 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-31 12:41:50 +0000 |
| commit | 066e9349f96b7bc56536d48aaae29d98f0ee76fa (patch) | |
| tree | 1d2f4e6a6edb7a279dac3c75a1c6ebfbaa9bb1ca /tests | |
| parent | 30427ac842000d10666b602a2a313058bc32708e (diff) | |
Add `calc.norm()` function to compute euclidean norms (#4581)
Co-authored-by: +merlan #flirora <uruwi@protonmail.com>
Co-authored-by: Yip Coekjan <69834864+Coekjan@users.noreply.github.com>
Co-authored-by: Malo <57839069+MDLC01@users.noreply.github.com>
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/suite/foundations/calc.typ | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/suite/foundations/calc.typ b/tests/suite/foundations/calc.typ index 5726dafa..23fdea89 100644 --- a/tests/suite/foundations/calc.typ +++ b/tests/suite/foundations/calc.typ @@ -368,3 +368,19 @@ // Error: 2-37 cannot apply this operation to a decimal and a float // Hint: 2-37 if loss of precision is acceptable, explicitly cast the decimal to a float with `float(value)` #calc.clamp(decimal("10"), 5.5, 6.6) + +--- calc-norm --- +#test(calc.norm(1, 2, -3, 0.5), calc.sqrt(14.25)) +#test(calc.norm(3, 4), 5.0) +#test(calc.norm(3, 4), 5.0) +#test(calc.norm(), 0.0) +#test(calc.norm(p: 3, 1, -2), calc.pow(9, 1/3)) +#test(calc.norm(p: calc.inf, 1, -2), 2.0) + +--- calc-norm-negative-p --- +// Error: 15-17 p must be greater than zero +#calc.norm(p: -1, 1) + +--- calc-norm-expected-float --- +// Error: 12-15 expected float, found ratio +#calc.norm(10%) |
