6namespace uni20::detail::native_math
8template <NativeReal R> R
sec(R x) {
return R(1) / std::cos(x); }
9template <NativeReal R> R
csc(R x) {
return R(1) / std::sin(x); }
10template <NativeReal R> R
cot(R x) {
return R(1) / std::tan(x); }
11template <NativeReal R> R
coth(R x) {
return R(1) / std::tanh(x); }
13template <
bool Sine, NativeReal R> R reciprocal_hyperbolic(R x)
15 using L = numeric_limits<R>;
17 if (magnitude <= R(L::digits()))
return R(1) / (Sine ? std::sinh(x) :
std::
cosh(x));
22 if (magnitude < R(-L::min_exponent) * log_two<R>)
23 result = R(2) * std::exp(-magnitude);
28 R half = std::exp(-magnitude / 2);
29 result = half * (R(2) * half);
31 if constexpr (Sine)
return std::copysign(result, x);
34template <NativeReal R> R
sech(R x) {
return reciprocal_hyperbolic<false>(x); }
35template <NativeReal R> R
csch(R x) {
return reciprocal_hyperbolic<true>(x); }
DiagnosticMagnitude< R > magnitude(R const &value)
Definition gmres_diagnostics.hpp:98
constexpr detail::scalar_math::csch_fn csch
Reciprocal hyperbolic sine, retaining the input type and precision.
Definition math.hpp:660
constexpr detail::scalar_math::sech_fn sech
Reciprocal hyperbolic cosine, retaining the input type and precision.
Definition math.hpp:658
constexpr detail::scalar_math::cot_fn cot
Reciprocal tangent, retaining the input type and precision.
Definition math.hpp:656
constexpr detail::scalar_math::coth_fn coth
Reciprocal hyperbolic tangent, retaining the input type and precision.
Definition math.hpp:662
constexpr detail::scalar_math::sec_fn sec
Reciprocal cosine, retaining the input type and precision.
Definition math.hpp:652
constexpr detail::scalar_math::csc_fn csc
Reciprocal sine, retaining the input type and precision.
Definition math.hpp:654
mpcomplex cosh(mpcomplex const &z)
Hyperbolic cosine at the input precision; exact zero returns exact one.
Definition mpcomplex.hpp:511