diff options
| author | klMse <61806749+klMse@users.noreply.github.com> | 2023-09-06 14:27:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-06 14:27:44 +0200 |
| commit | 97ca009bb841902e00ff5cdfdf77459f47d088ef (patch) | |
| tree | a6f84c218772bc2e26a8f80d61a7081df99eff36 /crates/typst-library/src | |
| parent | 65aeea31423ec9ea872c52f41469ad6adbeded17 (diff) | |
Fix arguments for hyberbolic functions (#2072)
Diffstat (limited to 'crates/typst-library/src')
| -rw-r--r-- | crates/typst-library/src/compute/calc.rs | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/crates/typst-library/src/compute/calc.rs b/crates/typst-library/src/compute/calc.rs index 7cfe2491..83ecac5d 100644 --- a/crates/typst-library/src/compute/calc.rs +++ b/crates/typst-library/src/compute/calc.rs @@ -356,76 +356,58 @@ pub fn atan2( Angle::rad(f64::atan2(y.float(), x.float())) } -/// Calculates the hyperbolic sine of an angle. -/// -/// When called with an integer or a float, they will be interpreted as radians. +/// Calculates the hyperbolic sine of a hyperbolic angle. /// /// ## Example { #example } /// ```example /// #calc.sinh(0) \ -/// #calc.sinh(45deg) +/// #calc.sinh(1.5) /// ``` /// /// Display: Hyperbolic sine /// Category: calculate #[func] pub fn sinh( - /// The angle whose hyperbolic sine to calculate. - angle: AngleLike, + /// The hyperbolic angle whose hyperbolic sine to calculate. + value: f64, ) -> f64 { - match angle { - AngleLike::Angle(a) => a.to_rad().sinh(), - AngleLike::Int(n) => (n as f64).sinh(), - AngleLike::Float(n) => n.sinh(), - } + value.sinh() } -/// Calculates the hyperbolic cosine of an angle. -/// -/// When called with an integer or a float, they will be interpreted as radians. +/// Calculates the hyperbolic cosine of a hyperbolic angle. /// /// ## Example { #example } /// ```example /// #calc.cosh(0) \ -/// #calc.cosh(45deg) +/// #calc.cosh(1.5) /// ``` /// /// Display: Hyperbolic cosine /// Category: calculate #[func] pub fn cosh( - /// The angle whose hyperbolic cosine to calculate. - angle: AngleLike, + /// The hyperbolic angle whose hyperbolic cosine to calculate. + value: f64, ) -> f64 { - match angle { - AngleLike::Angle(a) => a.to_rad().cosh(), - AngleLike::Int(n) => (n as f64).cosh(), - AngleLike::Float(n) => n.cosh(), - } + value.cosh() } -/// Calculates the hyperbolic tangent of an angle. -/// -/// When called with an integer or a float, they will be interpreted as radians. +/// Calculates the hyperbolic tangent of an hyperbolic angle. /// /// ## Example { #example } /// ```example /// #calc.tanh(0) \ -/// #calc.tanh(45deg) +/// #calc.tanh(1.5) /// ``` /// /// Display: Hyperbolic tangent /// Category: calculate #[func] pub fn tanh( - /// The angle whose hyperbolic tangent to calculate. - angle: AngleLike, + /// The hyperbolic angle whose hyperbolic tangent to calculate. + value: f64, ) -> f64 { - match angle { - AngleLike::Angle(a) => a.to_rad().tanh(), - AngleLike::Int(n) => (n as f64).tanh(), - AngleLike::Float(n) => n.tanh(), - } + value.tanh() } /// Calculates the logarithm of a number. |
