pub fn primitive_float_sinh_rational<T>(x: &Rational) -> Twhere
Float: PartialOrd<T>,
for<'a> T: ExactFrom<&'a Float> + RoundingFrom<&'a Float> + PrimitiveFloat,Expand description
Computes $\sinh x$, the hyperbolic sine of a Rational, returning the result as a primitive
float. The result is correctly rounded.
$$ f(x) = \sinh x+\varepsilon. $$
- If $\sinh x$ is infinite or zero, $\varepsilon$ may be ignored or assumed to be 0.
- If $\sinh x$ is finite and nonzero, then $|\varepsilon| < 2^{\lfloor\log_2 |\sinh
x|\rfloor-p}$, where $p$ is the precision of the output (typically 24 if
Tis af32and 53 ifTis af64, but less if the output is subnormal).
Special cases:
- $f(0)=0.0$
Overflow and underflow are possible: an x of large magnitude gives $\infty$ or $-\infty$, and
an x of small enough magnitude gives 0.0 or -0.0.
§Worst-case complexity
$T(m) = O(m (\log m)^2 \log\log m)$
$M(m) = O(m \log m)$
where $T$ is time, $M$ is additional memory, and $m$ is x.significant_bits().
§Examples
use malachite_base::num::basic::traits::{NegativeInfinity, Zero};
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::sinh::primitive_float_sinh_rational;
use malachite_q::Rational;
assert_eq!(
NiceFloat(primitive_float_sinh_rational::<f64>(&Rational::ZERO)),
NiceFloat(0.0)
);
assert_eq!(
NiceFloat(primitive_float_sinh_rational::<f64>(
&Rational::from_unsigneds(1u8, 3)
)),
NiceFloat(0.3395405572561501)
);
assert_eq!(
NiceFloat(primitive_float_sinh_rational::<f64>(&Rational::from(
-10000
))),
NiceFloat(f64::NEGATIVE_INFINITY)
);