Fix arguments for hyberbolic functions (#2072)

This commit is contained in:
klMse 2023-09-06 14:27:44 +02:00 committed by GitHub
parent 65aeea3142
commit 97ca009bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.