pub fn primitive_float_acsc_pi_rational<T>(x: &Rational) -> TExpand description
Computes $\operatorname{acsc}(x)/\pi$, the arccosecant of a Rational measured in half-turns,
returning the result as a primitive float.
This is primitive_float_acsc_with_period_rational with a period of 2: see
primitive_float_acsc_with_period_rational for the error bounds, the special cases, and the
complexity, with $u = 2$. An input of $\pm1$ gives $\pm1/2$; any $|x|<1$ gives NaN. Overflow is
not possible, since $|\operatorname{acsc}(x)/\pi| \leq 1/2$.
§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::basic::traits::{NegativeOne, One, OneHalf};
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::acsc::primitive_float_acsc_pi_rational;
use malachite_q::Rational;
// the arccosecant is NaN inside (-1, 1)
assert!(primitive_float_acsc_pi_rational::<f64>(&Rational::ONE_HALF).is_nan());
assert_eq!(
NiceFloat(primitive_float_acsc_pi_rational::<f64>(&Rational::ONE)),
NiceFloat(0.5)
);
assert_eq!(
NiceFloat(primitive_float_acsc_pi_rational::<f64>(
&Rational::NEGATIVE_ONE
)),
NiceFloat(-0.5)
);
assert_eq!(
NiceFloat(primitive_float_acsc_pi_rational::<f64>(
&Rational::from_unsigneds(5u8, 3)
)),
NiceFloat(0.20483276469913345)
);
assert_eq!(
NiceFloat(primitive_float_acsc_pi_rational::<f32>(
&Rational::from_unsigneds(5u8, 3)
)),
NiceFloat(0.20483276)
);