pub fn primitive_float_sec_pi_rational<T>(x: &Rational) -> Twhere
Float: PartialOrd<T>,
for<'a> T: ExactFrom<&'a Float> + RoundingFrom<&'a Float> + PrimitiveFloat,Expand description
Computes $\sec(\pi x)$, the secant of a Rational measured in half-turns, returning the
result as a primitive float.
This is primitive_float_sec_with_period_rational with a period of 2: see
primitive_float_sec_with_period_rational for the error bound, the special cases, and the
complexity, with $u = 2$.
§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::OneHalf;
use malachite_base::num::float::NiceFloat;
use malachite_float::float::arithmetic::sec::primitive_float_sec_pi_rational;
use malachite_q::Rational;
// a half of a half-turn is a pole
assert_eq!(
NiceFloat(primitive_float_sec_pi_rational::<f64>(&Rational::ONE_HALF)),
NiceFloat(f64::INFINITY)
);
// a sixth of a half-turn: 2 sqrt(3)/3
assert_eq!(
NiceFloat(primitive_float_sec_pi_rational::<f64>(
&Rational::from_unsigneds(1u8, 6)
)),
NiceFloat(1.1547005383792515)
);
assert_eq!(
NiceFloat(primitive_float_sec_pi_rational::<f64>(
&Rational::from_unsigneds(1u8, 7)
)),
NiceFloat(1.1099162641747424)
);