pub fn primitive_float_acoth_rational<T>(x: &Rational) -> Twhere
Float: PartialOrd<T>,
for<'a> T: ExactFrom<&'a Float> + RoundingFrom<&'a Float> + PrimitiveFloat,Expand description
Computes $\operatorname{acoth} x$, the inverse hyperbolic cotangent of a Rational, returning
the result as a primitive float. The result is correctly rounded.
$$ f(x) = \operatorname{acoth} x+\varepsilon. $$
- If $\operatorname{acoth} x$ is infinite, zero, or NaN, $\varepsilon$ may be ignored or assumed to be 0.
- If $\operatorname{acoth} x$ is finite and nonzero, then $|\varepsilon| < 2^{\lfloor\log_2
|\operatorname{acoth} 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(\pm1)=\pm\infty$
- $f(x)=\text{NaN}$ if $|x|<1$
Overflow is not possible. Underflow is: an x of large 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::{One, Zero};
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::acoth::primitive_float_acoth_rational;
use malachite_q::Rational;
assert!(primitive_float_acoth_rational::<f64>(&Rational::ZERO).is_nan());
assert_eq!(
NiceFloat(primitive_float_acoth_rational::<f64>(&Rational::ONE)),
NiceFloat(f64::INFINITY)
);
assert_eq!(
NiceFloat(primitive_float_acoth_rational::<f64>(&Rational::from(3u32))),
NiceFloat(0.34657359027997264)
);