pub fn primitive_float_acsc<T>(x: T) -> Twhere
Float: From<T> + PartialOrd<T>,
for<'a> T: ExactFrom<&'a Float> + RoundingFrom<&'a Float> + PrimitiveFloat,Expand description
Computes $\operatorname{acsc} x$, the arccosecant of a primitive float, returning the result as a primitive float.
This is the correctly rounded arccosecant: the exact $\operatorname{acsc}(x)$ is rounded once, to the nearest value of the input’s type.
Special cases:
- $f(\text{NaN})=\text{NaN}$
- $f(x)=\text{NaN}$ for $|x|<1$, including $\pm0.0$
- $f(\infty)=0.0$ and $f(-\infty)=-0.0$
Overflow is not possible, since $|\operatorname{acsc}(x)| \leq \pi/2$, and neither is underflow: a primitive float’s exponent is bounded, so $1/|x|$ stays well inside the normal range.
§Worst-case complexity
$T(m) = O(m \log m \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::float::NiceFloat;
use malachite_float::float::arithmetic::acsc::primitive_float_acsc;
assert!(primitive_float_acsc(f32::NAN).is_nan());
// the arccosecant is NaN inside (-1, 1)
assert!(primitive_float_acsc(0.5f32).is_nan());
assert_eq!(
NiceFloat(primitive_float_acsc(f32::INFINITY)),
NiceFloat(0.0)
);
assert_eq!(
NiceFloat(primitive_float_acsc(2.0f32)),
NiceFloat(0.5235988)
);
assert_eq!(
NiceFloat(primitive_float_acsc(-2.0f32)),
NiceFloat(-0.5235988)
);
assert_eq!(
NiceFloat(primitive_float_acsc(2.0f64)),
NiceFloat(0.5235987755982989)
);