50template <
class T>
constexpr bool is_exact(detail::standard_complex<T>
const& x)
79template <Real R>
constexpr R
conj(R
const& x) {
return x; }
88template <Integer I>
constexpr I
conj(I
const& x) {
return x; }
102template <
typename T,
typename =
void>
struct numeric_limits_has_infinity : std::false_type
106struct numeric_limits_has_infinity<
107 T,
std::void_t<decltype(uni20::numeric_limits<T>::has_infinity), decltype(uni20::numeric_limits<T>::infinity())>>
108 : std::bool_constant<static_cast<bool>(uni20::numeric_limits<T>::has_infinity)>
112inline constexpr bool numeric_limits_has_infinity_v = numeric_limits_has_infinity<std::remove_cvref_t<T>>
::value;
121template <Integer I>
constexpr bool isfinite(I
const& x)
noexcept
135template <Real R>
constexpr bool isfinite(R
const& x)
137 using value_type = std::remove_cvref_t<R>;
139 if constexpr (std::same_as<value_type, mpreal>)
return uni20::isfinite(x);
145 if constexpr (detail::numeric_limits_has_infinity_v<value_type>)
148 return x != infinity && x != -infinity;
161template <Complex C>
constexpr bool isfinite(C
const& z)
173template <
typename T>
constexpr T& real(detail::standard_complex<T>& z)
noexcept {
return reinterpret_cast<T*
>(&z)[0]; }
184template <
typename T>
constexpr T& imag(detail::standard_complex<T>& z)
noexcept {
return reinterpret_cast<T*
>(&z)[1]; }
192template <Scalar S,
class Value>
193 requires(std::constructible_from<S, Value const&> ||
194 requires(S
const& exemplar, Value
const&
value) { S(
value, exemplar.precision()); })
197 if constexpr (
requires { S(
value, exemplar.precision()); })
198 return S(
value, exemplar.precision());
203namespace detail::scalar_math
206concept native_argument =
207 std::integral<T> || std::same_as<T, float> || std::same_as<T, double> || std::same_as<T, long double>
208#if UNI20_HAS_FLOAT128
209 || std::same_as<T, uni20::float128>
215template <
class Result,
class Arg>
consteval bool preserves_real_precision()
217 if constexpr (!Real<Arg>)
219 else if constexpr (Real<Result>)
220 return numeric_limits<Result>::digits() >= numeric_limits<Arg>::digits() &&
221 numeric_limits<Result>::max_exponent >= numeric_limits<Arg>::max_exponent;
229#define UNI20_SCALAR_MATH_ADL(NAME) \
230 namespace NAME##_adl \
232 template <class... Args> void NAME(Args const&...) = delete; \
233 template <class... Args> \
234 constexpr auto call(Args const&... args) noexcept(noexcept(NAME(args...))) -> decltype(NAME(args...)) \
236 return NAME(args...); \
240#define UNI20_SCALAR_MATH_DISPATCH_TO(NAME, NATIVE, RESULT_CHECK) \
241 UNI20_SCALAR_MATH_ADL(NAME) \
244 template <class... Args> \
245 constexpr auto operator()(Args const&... args) const \
246 noexcept(noexcept(NAME##_adl::call(args...))) -> decltype(NAME##_adl::call(args...)) \
248 return NAME##_adl::call(args...); \
250 template <class... Args> \
251 requires((native_argument<Args> && ...) && !requires(Args const&... args) { NAME##_adl::call(args...); }) \
252 constexpr auto operator()(Args const&... args) const \
253 noexcept(noexcept(NATIVE::NAME(args...))) -> decltype(NATIVE::NAME(args...)) \
254 requires((RESULT_CHECK<decltype(NATIVE::NAME(args...)), Args>()) && ...) \
256 return NATIVE::NAME(args...); \
260template <
class Result,
class Arg>
consteval bool predicate_result() {
return std::same_as<Result, bool>; }
261template <
class Result,
class Arg>
consteval bool preserves_components()
263 return preserves_real_precision<typename Result::value_type, Arg>();
267template <
class Result,
class Arg>
consteval bool utility_result() {
return true; }
270#define UNI20_SCALAR_MATH_DISPATCH_ADL_ONLY(NAME) \
271 UNI20_SCALAR_MATH_ADL(NAME) \
274 template <class... Args> \
275 constexpr auto operator()(Args const&... args) const \
276 noexcept(noexcept(NAME##_adl::call(args...))) -> decltype(NAME##_adl::call(args...)) \
278 return NAME##_adl::call(args...); \
282#define UNI20_SCALAR_MATH_DISPATCH_POLICY(NAME, CHECK) UNI20_SCALAR_MATH_DISPATCH_TO(NAME, std, CHECK)
283#define UNI20_SCALAR_MATH_DISPATCH(NAME) UNI20_SCALAR_MATH_DISPATCH_POLICY(NAME, preserves_real_precision)
374#undef UNI20_SCALAR_MATH_DISPATCH_ADL_ONLY
375#undef UNI20_SCALAR_MATH_DISPATCH_TO
376#undef UNI20_SCALAR_MATH_DISPATCH_POLICY
377#undef UNI20_SCALAR_MATH_DISPATCH
382#undef UNI20_SCALAR_MATH_ADL
387 requires(Real<T> || std::integral<T>)
388 constexpr T
operator()(T
const&
value)
const
390 if constexpr (std::integral<T>)
396 requires(!Real<T> && !std::integral<T>)
397 constexpr auto operator()(T
const&
value)
const
398 noexcept(
noexcept(std::remove_cvref_t<
decltype(real_adl::call(
value))>(real_adl::call(
value))))
399 -> std::remove_cvref_t<
decltype(real_adl::call(
value))>
400 requires std::constructible_from<std::remove_cvref_t<
decltype(real_adl::call(
value))>,
401 decltype(real_adl::call(
value))>
403 return std::remove_cvref_t<decltype(real_adl::call(value))>(real_adl::call(
value));
410 requires(Real<T> || std::integral<T>)
411 constexpr T
operator()(T
const&
value)
const
413 if constexpr (native_argument<T>)
419 requires(!Real<T> && !std::integral<T>)
420 constexpr auto operator()(T
const&
value)
const
421 noexcept(
noexcept(std::remove_cvref_t<
decltype(imag_adl::call(
value))>(imag_adl::call(
value))))
422 -> std::remove_cvref_t<
decltype(imag_adl::call(
value))>
423 requires std::constructible_from<std::remove_cvref_t<
decltype(imag_adl::call(
value))>,
424 decltype(imag_adl::call(
value))>
426 return std::remove_cvref_t<decltype(imag_adl::call(value))>(imag_adl::call(
value));
433 requires(Real<T> || std::integral<T>)
434 constexpr T
operator()(T
const&
value)
const
436 if constexpr (std::integral<T>)
442 requires(!Real<T> && !std::integral<T>)
443 constexpr auto operator()(T
const&
value)
const
444 noexcept(
noexcept(conj_adl::call(
value))) ->
decltype(conj_adl::call(
value))
446 return conj_adl::call(
value);
459inline constexpr detail::scalar_math::abs_fn
abs{};
461inline constexpr detail::scalar_math::sqrt_fn
sqrt{};
463inline constexpr detail::scalar_math::pow_fn
pow{};
465inline constexpr detail::scalar_math::exp_fn
exp{};
467inline constexpr detail::scalar_math::log_fn
log{};
469inline constexpr detail::scalar_math::log2_fn
log2{};
471inline constexpr detail::scalar_math::sin_fn
sin{};
473inline constexpr detail::scalar_math::cos_fn
cos{};
475inline constexpr detail::scalar_math::cbrt_fn
cbrt{};
477inline constexpr detail::scalar_math::exp2_fn
exp2{};
479inline constexpr detail::scalar_math::expm1_fn
expm1{};
481inline constexpr detail::scalar_math::log10_fn
log10{};
483inline constexpr detail::scalar_math::log1p_fn
log1p{};
485inline constexpr detail::scalar_math::asin_fn
asin{};
487inline constexpr detail::scalar_math::acos_fn
acos{};
489inline constexpr detail::scalar_math::sinh_fn
sinh{};
491inline constexpr detail::scalar_math::cosh_fn
cosh{};
493inline constexpr detail::scalar_math::tanh_fn
tanh{};
495inline constexpr detail::scalar_math::asinh_fn
asinh{};
497inline constexpr detail::scalar_math::acosh_fn
acosh{};
499inline constexpr detail::scalar_math::atanh_fn
atanh{};
501inline constexpr detail::scalar_math::tan_fn
tan{};
503inline constexpr detail::scalar_math::atan_fn
atan{};
505inline constexpr detail::scalar_math::atan2_fn
atan2{};
507inline constexpr detail::scalar_math::hypot_fn
hypot{};
509inline constexpr detail::scalar_math::ceil_fn
ceil{};
511inline constexpr detail::scalar_math::ldexp_fn
ldexp{};
513inline constexpr detail::scalar_math::floor_fn
floor{};
515inline constexpr detail::scalar_math::trunc_fn
trunc{};
517inline constexpr detail::scalar_math::round_fn
round{};
519inline constexpr detail::scalar_math::isfinite_fn
isfinite{};
521inline constexpr detail::scalar_math::isnan_fn
isnan{};
523inline constexpr detail::scalar_math::isinf_fn
isinf{};
525inline constexpr detail::scalar_math::signbit_fn
signbit{};
527inline constexpr detail::scalar_math::round_even_fn
round_even{};
529inline constexpr detail::scalar_math::pown_fn
pown{};
531inline constexpr detail::scalar_math::rootn_fn
rootn{};
533inline constexpr detail::scalar_math::scalbn_fn
scalbn{};
535inline constexpr detail::scalar_math::frexp_fn
frexp{};
537inline constexpr detail::scalar_math::modf_fn
modf{};
539inline constexpr detail::scalar_math::remquo_fn
remquo{};
541inline constexpr detail::scalar_math::sincos_fn
sincos{};
543inline constexpr detail::scalar_math::sinhcosh_fn
sinhcosh{};
545inline constexpr detail::scalar_math::ilogb_fn
ilogb{};
547inline constexpr detail::scalar_math::copysign_fn
copysign{};
549inline constexpr detail::scalar_math::nextafter_fn
nextafter{};
551inline constexpr detail::scalar_math::next_up_fn
next_up{};
553inline constexpr detail::scalar_math::next_down_fn
next_down{};
555inline constexpr detail::scalar_math::fma_fn
fma{};
557inline constexpr detail::scalar_math::fdim_fn
fdim{};
559inline constexpr detail::scalar_math::fmin_fn
fmin{};
561inline constexpr detail::scalar_math::fmax_fn
fmax{};
563inline constexpr detail::scalar_math::fmod_fn
fmod{};
565inline constexpr detail::scalar_math::remainder_fn
remainder{};
567inline constexpr detail::scalar_math::tgamma_fn
tgamma{};
569inline constexpr detail::scalar_math::lgamma_fn
lgamma{};
572inline constexpr detail::scalar_math::lgamma_sign_fn
lgamma_sign{};
578inline constexpr detail::scalar_math::digamma_fn
digamma{};
586inline constexpr detail::scalar_math::beta_fn
beta{};
593inline constexpr detail::scalar_math::upper_gamma_fn
upper_gamma{};
595inline constexpr detail::scalar_math::erf_fn
erf{};
597inline constexpr detail::scalar_math::erfc_fn
erfc{};
601inline constexpr detail::scalar_math::zeta_fn
zeta{};
605inline constexpr detail::scalar_math::expint_fn
expint{};
609inline constexpr detail::scalar_math::dilog_real_fn
dilog_real{};
613inline constexpr detail::scalar_math::bessel_j_fn
bessel_j{};
617inline constexpr detail::scalar_math::bessel_y_fn
bessel_y{};
620inline constexpr detail::scalar_math::airy_ai_fn
airy_ai{};
625inline constexpr detail::scalar_math::agm_fn
agm{};
627inline constexpr detail::scalar_math::factorial_fn
factorial{};
630inline constexpr detail::scalar_math::exp10_fn
exp10{};
632inline constexpr detail::scalar_math::exp2m1_fn
exp2m1{};
634inline constexpr detail::scalar_math::exp10m1_fn
exp10m1{};
636inline constexpr detail::scalar_math::log2p1_fn
log2p1{};
638inline constexpr detail::scalar_math::log10p1_fn
log10p1{};
640inline constexpr detail::scalar_math::sinpi_fn
sinpi{};
642inline constexpr detail::scalar_math::cospi_fn
cospi{};
644inline constexpr detail::scalar_math::tanpi_fn
tanpi{};
646inline constexpr detail::scalar_math::asinpi_fn
asinpi{};
648inline constexpr detail::scalar_math::acospi_fn
acospi{};
650inline constexpr detail::scalar_math::atanpi_fn
atanpi{};
652inline constexpr detail::scalar_math::sec_fn
sec{};
654inline constexpr detail::scalar_math::csc_fn
csc{};
656inline constexpr detail::scalar_math::cot_fn
cot{};
658inline constexpr detail::scalar_math::sech_fn
sech{};
660inline constexpr detail::scalar_math::csch_fn
csch{};
662inline constexpr detail::scalar_math::coth_fn
coth{};
664inline constexpr detail::scalar_math::atan2pi_fn
atan2pi{};
668inline constexpr detail::scalar_math::compound_fn
compound{};
671inline constexpr detail::scalar_math::real_fn
real{};
673inline constexpr detail::scalar_math::imag_fn
imag{};
675inline constexpr detail::scalar_math::conj_fn
conj{};
684 return magnitude * magnitude;
Concept for integer scalar types (excluding char and bool).
Definition scalar_concepts.hpp:63
Concept for real scalar types (float, double, etc.).
Definition scalar_concepts.hpp:69
locale_t value
Definition data_table.cpp:49
uni20::complex< T > conj(detail::standard_complex< T > x)
Returns the complex conjugate for complex-valued scalars.
Definition math.hpp:70
constexpr bool has_trivial_conj
Indicates whether the Uni20 conjugation helper is a no-op for the provided scalar type.
Definition math.hpp:61
typename detail::complex_type< Real >::type complex
Project-level complex scalar spelling.
Definition types.hpp:66
constexpr auto herm(S x)
Computes the Hermitian adjoint of a scalar value.
Definition math.hpp:98
constexpr bool isfinite(I const &x) noexcept
Returns whether an integer scalar is finite.
Definition math.hpp:121
#define UNI20_SCALAR_MATH_DISPATCH(NAME)
Definition math.hpp:283
#define UNI20_SCALAR_MATH_DISPATCH_TO(NAME, NATIVE, RESULT_CHECK)
Definition math.hpp:240
#define UNI20_SCALAR_MATH_DISPATCH_POLICY(NAME, CHECK)
Definition math.hpp:282
#define UNI20_SCALAR_MATH_DISPATCH_ADL_ONLY(NAME)
Definition math.hpp:270
#define UNI20_SCALAR_MATH_ADL(NAME)
Definition math.hpp:229
constexpr detail::scalar_math::asinpi_fn asinpi
Principal arcsine divided by pi.
Definition math.hpp:646
constexpr detail::scalar_math::log2p1_fn log2p1
Base-two logarithm of one plus x, without rounding the sum first.
Definition math.hpp:636
constexpr detail::scalar_math::nextafter_fn nextafter
Adjacent value on the first operand grid toward the direction operand.
Definition math.hpp:549
constexpr detail::scalar_math::exp_fn exp
Natural exponential with scalar-specific precision handling.
Definition math.hpp:465
constexpr detail::scalar_math::acos_fn acos
Inverse cosine in radians.
Definition math.hpp:487
constexpr detail::scalar_math::csch_fn csch
Reciprocal hyperbolic sine, retaining the input type and precision.
Definition math.hpp:660
constexpr detail::scalar_math::tanh_fn tanh
Hyperbolic tangent.
Definition math.hpp:493
constexpr detail::scalar_math::atan2_fn atan2
Quadrant-aware inverse tangent of y/x in radians.
Definition math.hpp:505
constexpr detail::scalar_math::pown_fn pown
Integer power with scalar-specific rounding.
Definition math.hpp:529
constexpr detail::scalar_math::expint_fn expint
Real principal-value exponential integral Ei.
Definition math.hpp:605
constexpr detail::scalar_math::lgamma_sign_fn lgamma_sign
Log-absolute-Gamma and its sign as owning values.
Definition math.hpp:572
constexpr detail::scalar_math::compound_fn compound
Integer power of one plus x, retaining the original increment.
Definition math.hpp:668
constexpr detail::scalar_math::isfinite_fn isfinite
Whether a real scalar is finite.
Definition math.hpp:519
constexpr detail::scalar_math::asinh_fn asinh
Inverse hyperbolic sine.
Definition math.hpp:495
constexpr detail::scalar_math::upper_gamma_fn upper_gamma
Upper unregularized incomplete Gamma, with shape and lower integration endpoint.
Definition math.hpp:593
constexpr detail::scalar_math::asin_fn asin
Inverse sine in radians.
Definition math.hpp:485
constexpr detail::scalar_math::bessel_j_fn bessel_j
Integer-order Bessel function of the first kind, with order first.
Definition math.hpp:613
constexpr detail::scalar_math::cosh_fn cosh
Hyperbolic cosine.
Definition math.hpp:491
constexpr detail::scalar_math::atanpi_fn atanpi
Principal arctangent divided by pi.
Definition math.hpp:650
constexpr detail::scalar_math::round_fn round
Round to nearest integer with ties away from zero.
Definition math.hpp:517
constexpr detail::scalar_math::sinpi_fn sinpi
Sine of pi times x, with argument reduction before multiplication by pi.
Definition math.hpp:640
constexpr detail::scalar_math::remquo_fn remquo
Nearest-even remainder and signed low three quotient bits.
Definition math.hpp:539
constexpr detail::scalar_math::sinh_fn sinh
Hyperbolic sine.
Definition math.hpp:489
constexpr detail::scalar_math::ceil_fn ceil
Least integral value not less than the argument, in the scalar's result type.
Definition math.hpp:509
constexpr detail::scalar_math::atan2pi_fn atan2pi
Quadrant-aware arctangent divided by pi.
Definition math.hpp:664
constexpr detail::scalar_math::log1p_fn log1p
Natural logarithm of one plus the argument, retaining small increments.
Definition math.hpp:483
constexpr detail::scalar_math::conj_fn conj
Complex conjugation; real and integral values retain their type.
Definition math.hpp:675
constexpr detail::scalar_math::scalbn_fn scalbn
Binary scaling with a signed 64-bit exponent.
Definition math.hpp:533
constexpr detail::scalar_math::agm_fn agm
Nonnegative arithmetic-geometric mean.
Definition math.hpp:625
constexpr detail::scalar_math::log10p1_fn log10p1
Base-ten logarithm of one plus x, without rounding the sum first.
Definition math.hpp:638
constexpr detail::scalar_math::digamma_fn digamma
Logarithmic derivative of Gamma.
Definition math.hpp:578
constexpr detail::scalar_math::atan_fn atan
Inverse tangent in radians.
Definition math.hpp:503
constexpr detail::scalar_math::modf_fn modf
Signed fractional and integral parts as an owning result.
Definition math.hpp:537
constexpr detail::scalar_math::erf_fn erf
Real error function.
Definition math.hpp:595
constexpr detail::scalar_math::fdim_fn fdim
Positive difference, preserving NaN propagation.
Definition math.hpp:557
constexpr detail::scalar_math::cbrt_fn cbrt
Real cube root, including negative arguments.
Definition math.hpp:475
constexpr detail::scalar_math::ldexp_fn ldexp
Multiply by a power of two using the scalar's exponent interface.
Definition math.hpp:511
constexpr detail::scalar_math::log2_fn log2
Base-two logarithm where supplied by the scalar implementation.
Definition math.hpp:469
constexpr detail::scalar_math::pow_fn pow
Power with the selected scalar's domain, exactness and precision rules.
Definition math.hpp:463
constexpr detail::scalar_math::cos_fn cos
Cosine with scalar-specific precision handling.
Definition math.hpp:473
constexpr detail::scalar_math::ilogb_fn ilogb
Binary exponent of a finite nonzero value; throws otherwise.
Definition math.hpp:545
constexpr detail::scalar_math::exp2_fn exp2
Base-two exponential.
Definition math.hpp:477
constexpr detail::scalar_math::expm1_fn expm1
Natural exponential minus one, evaluated without subtractive cancellation.
Definition math.hpp:479
constexpr detail::scalar_math::acosh_fn acosh
Inverse hyperbolic cosine.
Definition math.hpp:497
constexpr detail::scalar_math::erfc_fn erfc
Complementary error function without subtractive cancellation.
Definition math.hpp:597
constexpr detail::scalar_math::exp10m1_fn exp10m1
Ten to the power x minus one, using the cancellation-safe provider.
Definition math.hpp:634
constexpr detail::scalar_math::signbit_fn signbit
Inspect the sign, including approximate negative zero.
Definition math.hpp:525
constexpr detail::scalar_math::sinhcosh_fn sinhcosh
Hyperbolic sine and cosine at one input.
Definition math.hpp:543
constexpr detail::scalar_math::sqrt_fn sqrt
Square root; exact inputs requiring approximation need an explicit finite precision.
Definition math.hpp:461
constexpr detail::scalar_math::factorial_fn factorial
MPFR factorial at an explicit arithmetic state; use uni20::factorial<Real> for a typed result.
Definition math.hpp:627
constexpr detail::scalar_math::atanh_fn atanh
Inverse hyperbolic tangent.
Definition math.hpp:499
constexpr detail::scalar_math::trunc_fn trunc
Round toward zero.
Definition math.hpp:515
constexpr detail::scalar_math::floor_fn floor
Round toward negative infinity.
Definition math.hpp:513
constexpr detail::scalar_math::tgamma_fn tgamma
Real Gamma function.
Definition math.hpp:567
constexpr detail::scalar_math::zeta_fn zeta
Real Riemann zeta with native Euler-Maclaurin evaluation and reflection.
Definition math.hpp:601
constexpr detail::scalar_math::sin_fn sin
Sine with scalar-specific precision handling.
Definition math.hpp:471
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::next_up_fn next_up
Adjacent value toward positive infinity.
Definition math.hpp:551
constexpr detail::scalar_math::coth_fn coth
Reciprocal hyperbolic tangent, retaining the input type and precision.
Definition math.hpp:662
constexpr detail::scalar_math::rootn_fn rootn
Real integer-order root; negative orders give reciprocal roots.
Definition math.hpp:531
constexpr detail::scalar_math::fmin_fn fmin
Minimum, preferring the numeric operand over a NaN.
Definition math.hpp:559
constexpr detail::scalar_math::exp2m1_fn exp2m1
Two to the power x minus one, using the cancellation-safe provider.
Definition math.hpp:632
constexpr detail::scalar_math::exp10_fn exp10
Base-ten exponential.
Definition math.hpp:630
constexpr detail::scalar_math::next_down_fn next_down
Adjacent value toward negative infinity.
Definition math.hpp:553
constexpr detail::scalar_math::abs_fn abs
Absolute value or complex magnitude, preserving the selected scalar implementation.
Definition math.hpp:459
constexpr detail::scalar_math::tan_fn tan
Tangent in radians.
Definition math.hpp:501
constexpr detail::scalar_math::acospi_fn acospi
Principal arccosine divided by pi.
Definition math.hpp:648
constexpr detail::scalar_math::tanpi_fn tanpi
Tangent of pi times x, with argument reduction before multiplication by pi.
Definition math.hpp:644
constexpr detail::scalar_math::isnan_fn isnan
Whether a real scalar is NaN.
Definition math.hpp:521
constexpr detail::scalar_math::log10_fn log10
Base-ten logarithm.
Definition math.hpp:481
constexpr detail::scalar_math::fma_fn fma
Fused multiplication and addition with one final rounding.
Definition math.hpp:555
constexpr detail::scalar_math::dilog_real_fn dilog_real
Real part of the dilogarithm.
Definition math.hpp:609
constexpr detail::scalar_math::fmax_fn fmax
Maximum, preferring the numeric operand over a NaN.
Definition math.hpp:561
constexpr detail::scalar_math::lgamma_fn lgamma
Logarithm of the absolute Gamma function; native providers are reentrant.
Definition math.hpp:569
constexpr detail::scalar_math::sincos_fn sincos
Sine and cosine at one input.
Definition math.hpp:541
constexpr detail::scalar_math::sec_fn sec
Reciprocal cosine, retaining the input type and precision.
Definition math.hpp:652
constexpr detail::scalar_math::real_fn real
Read the real component by value; real and integral scalars retain their type.
Definition math.hpp:671
constexpr detail::scalar_math::remainder_fn remainder
Remainder using the nearest-even integer quotient.
Definition math.hpp:565
constexpr detail::scalar_math::bessel_y_fn bessel_y
Integer-order Bessel function of the second kind, with order first.
Definition math.hpp:617
constexpr detail::scalar_math::airy_ai_fn airy_ai
Real Airy Ai; native inputs retain their precision and full negative-axis phase.
Definition math.hpp:620
constexpr detail::scalar_math::round_even_fn round_even
Nearest integer with ties to even.
Definition math.hpp:527
constexpr detail::scalar_math::frexp_fn frexp
Binary fraction and exponent as an owning result.
Definition math.hpp:535
constexpr detail::scalar_math::imag_fn imag
Read the imaginary component by value; real zero retains the input's type and precision.
Definition math.hpp:673
constexpr detail::scalar_math::copysign_fn copysign
Copy the sign while retaining the magnitude operand type and precision.
Definition math.hpp:547
constexpr detail::scalar_math::isinf_fn isinf
Whether a real scalar is infinite.
Definition math.hpp:523
constexpr detail::scalar_math::hypot_fn hypot
Euclidean length with scalar-specific overflow and underflow handling.
Definition math.hpp:507
constexpr detail::scalar_math::log_fn log
Natural logarithm with scalar-specific precision handling.
Definition math.hpp:467
constexpr detail::scalar_math::cospi_fn cospi
Cosine of pi times x, with argument reduction before multiplication by pi.
Definition math.hpp:642
constexpr detail::scalar_math::fmod_fn fmod
Remainder using a quotient truncated toward zero.
Definition math.hpp:563
constexpr detail::scalar_math::csc_fn csc
Reciprocal sine, retaining the input type and precision.
Definition math.hpp:654
auto abs_squared(T const &value)
Square the magnitude, evaluating the scalar absolute value once.
Definition math.hpp:681
constexpr detail::scalar_math::beta_fn beta
Real Beta function.
Definition math.hpp:586
Definition async/async.hpp:26
mpcomplex acosh(mpcomplex const &z)
Principal inverse hyperbolic cosine, with imaginary signed zero selecting the cut side.
Definition mpcomplex.hpp:514
mpreal fmod(mpreal const &a, mpreal const &b)
Truncating-quotient remainder; exact operands retain exact rational results.
Definition mpreal_functions.hpp:522
bool isnan(mpcomplex const &z)
Definition mpcomplex.hpp:499
mpreal nextafter(mpreal const &x, mpreal const &direction)
Adjacent value on x's grid toward direction, whose precision may differ.
Definition mpreal_functions.hpp:335
mpreal asinpi(mpreal const &x)
Principal arcsine divided by pi.
Definition mpreal_extensions.hpp:145
mpreal expint(mpreal const &x)
Real exponential integral Ei, with its real principal-value meaning.
Definition mpreal_special.hpp:149
mpreal tgamma(mpreal const &x)
Real Gamma function; exact positive integers produce exact factorials.
Definition mpreal_special.hpp:124
mpreal coth(mpreal const &x)
Reciprocal hyperbolic tangent, evaluated directly by MPFR.
Definition mpreal_extensions.hpp:185
mpreal tan(mpreal const &x)
Definition mpreal.hpp:657
mpreal erf(mpreal const &x)
Error function, retaining exact zero or the input precision.
Definition mpreal_special.hpp:134
mpcomplex sinh(mpcomplex const &z)
Hyperbolic sine at the input precision; exact zero remains exact.
Definition mpcomplex.hpp:509
modf_result< mpreal > modf(mpreal const &x)
Signed fractional and integral parts, using truncation toward zero.
Definition mpreal_functions.hpp:506
constexpr auto abs(basic_half_int< T > value) -> basic_half_int< T >
Return the absolute value of a half-integer.
Definition half_int.hpp:431
mpreal dilog_real(mpreal const &x)
Real part of the dilogarithm; this is not a complex branch-valued API.
Definition mpreal_special.hpp:154
mpreal expm1(mpreal const &x)
Exponential minus one without cancellation; retain input precision or exact zero.
Definition mpreal.hpp:722
mpreal pown(mpreal const &x, I exponent)
Integer power, preserving exact rational results or the input's finite precision.
Definition mpreal_functions.hpp:695
mpreal scalbn(mpreal const &x, I exponent)
Binary scaling, identical to ldexp for Uni20's binary scalar formats.
Definition mpreal_functions.hpp:216
mpreal atan(mpreal const &x)
Definition mpreal.hpp:658
mpreal rootn(mpreal const &x, I degree)
Real integer-order root; negative orders give reciprocal roots.
Definition mpreal_functions.hpp:708
mpreal airy_ai(mpreal const &x)
Real Airy Ai; MPFR recommends arguments with magnitude below about 500.
Definition mpreal_special.hpp:159
mpreal sec(mpreal const &x)
Reciprocal cosine, evaluated directly by MPFR.
Definition mpreal_extensions.hpp:160
exact_rational sqrt(X const &value)
Return the nonnegative rational square root, or require finite precision.
Definition exact_rational.hpp:355
mpreal round_even(mpreal const &x)
Round to nearest integer, with ties to even; exact inputs produce exact integers.
Definition mpreal_functions.hpp:111
mpreal fma(mpreal const &a, mpreal const &b, mpreal const &c)
Compute a*b+c with one rounding, including mixed exact rational operands.
Definition mpreal_functions.hpp:192
R factorial(I n)
Factorial of a checked nonnegative integer, with an explicit native result type.
Definition factorial.hpp:15
mpreal next_up(mpreal const &x)
Next value toward positive infinity on the input's finite grid.
Definition mpreal_functions.hpp:306
mpcomplex log(mpcomplex const &z)
Principal logarithm, with the sign of imaginary zero selecting the cut side.
Definition mpcomplex.hpp:505
bool isinf(mpcomplex const &z)
Definition mpcomplex.hpp:500
mpreal acos(mpreal const &x)
Inverse cosine in radians; retain input precision or a supported exact result.
Definition mpreal.hpp:757
mpreal csc(mpreal const &x)
Reciprocal sine, evaluated directly by MPFR.
Definition mpreal_extensions.hpp:165
mpreal fmax(mpreal const &a, mpreal const &b)
Maximum with NaN suppression and positive-zero preference.
Definition mpreal_functions.hpp:272
mpreal cot(mpreal const &x)
Reciprocal tangent, evaluated directly by MPFR.
Definition mpreal_extensions.hpp:170
mpreal bessel_j(I n, mpreal const &x)
Bessel function of the first kind, with a checked signed integer order.
Definition mpreal_special.hpp:227
mpreal exp10m1(mpreal const &x)
Ten to the power x minus one, using the cancellation-safe provider.
Definition mpreal_extensions.hpp:115
mpreal log2p1(mpreal const &x)
Base-two logarithm of one plus x, without rounding the sum first.
Definition mpreal_extensions.hpp:120
mpcomplex cosh(mpcomplex const &z)
Hyperbolic cosine at the input precision; exact zero returns exact one.
Definition mpcomplex.hpp:511
mpreal fmin(mpreal const &a, mpreal const &b)
Minimum with NaN suppression and negative-zero preference.
Definition mpreal_functions.hpp:261
mpreal tanh(mpreal const &x)
Hyperbolic tangent; retain input precision or a supported exact result.
Definition mpreal.hpp:778
lgamma_result< mpreal > lgamma_sign(mpreal const &x)
Log(abs(Gamma(x))) and the sign of Gamma, as owning values.
Definition mpreal_special.hpp:184
frexp_result< mpreal > frexp(mpreal const &x)
Decompose into a binary fraction and signed 64-bit exponent.
Definition mpreal_functions.hpp:498
mpreal log2(mpreal const &x)
Base-two logarithm; retain input precision or a supported exact result.
Definition mpreal.hpp:729
mpreal cbrt(mpreal const &x)
Real cube root, including negative arguments; retain input precision or a supported exact result.
Definition mpreal.hpp:708
mpreal compound(mpreal const &x, I n)
Compute (1+x)^n without rounding the sum first, for x >= -1.
Definition mpreal_functions.hpp:741
mpreal atan2pi(mpreal const &y, mpreal const &x)
Quadrant-aware arctangent of y/x, divided by pi.
Definition mpreal_extensions.hpp:192
mpreal next_down(mpreal const &x)
Next value toward negative infinity on the input's finite grid.
Definition mpreal_functions.hpp:320
mpreal exp10(mpreal const &x)
Base-ten exponential.
Definition mpreal_extensions.hpp:105
mpreal exp2(mpreal const &x)
Base-two exponential; retain input precision or a supported exact result.
Definition mpreal.hpp:715
mpreal log10(mpreal const &x)
Base-ten logarithm; retain input precision or a supported exact result.
Definition mpreal.hpp:736
mpreal fdim(mpreal const &a, mpreal const &b)
Positive difference max(a-b,0), propagating NaNs.
Definition mpreal_functions.hpp:294
mpreal upper_gamma(mpreal const &a, mpreal const &x)
Upper incomplete Gamma, with shape a and lower integration endpoint x.
Definition mpreal_special.hpp:169
constexpr bool is_exact(detail::standard_complex< T > const &x)
A standard complex value is exact only when both components are exact.
Definition math.hpp:50
mpreal hypot(mpreal const &x, mpreal const &y)
Definition mpreal.hpp:660
mpreal zeta(mpreal const &x)
Riemann zeta; nonpositive integer arguments retain exact rational results.
Definition mpreal_special.hpp:144
mpreal cospi(mpreal const &x)
Cosine of pi times x, with provider argument reduction.
Definition mpreal_extensions.hpp:135
bool signbit(mpreal const &x)
Definition mpreal.hpp:642
mpreal erfc(mpreal const &x)
Complementary error function, evaluated without subtracting erf from one.
Definition mpreal_special.hpp:139
mpreal round(mpreal const &x)
Round to nearest integer, with ties away from zero; exact inputs produce exact integers.
Definition mpreal_functions.hpp:98
constexpr auto scalar_like(S const &exemplar, Value const &value) -> S
Construct a scalar using an exemplar's type and numerical precision.
Definition math.hpp:195
sincos_result< mpreal > sincos(mpreal const &x)
Evaluate sine and cosine using the paired provider routine.
Definition mpreal_functions.hpp:583
mpreal trunc(mpreal const &x)
Round toward zero; exact inputs produce exact integers.
Definition mpreal_functions.hpp:85
mpreal agm(mpreal const &a, mpreal const &x)
Nonnegative real arithmetic-geometric mean.
Definition mpreal_special.hpp:177
mpreal sech(mpreal const &x)
Reciprocal hyperbolic cosine, evaluated directly by MPFR.
Definition mpreal_extensions.hpp:175
mpreal ldexp(mpreal const &x, I exponent)
Multiply by 2^exponent, preserving exact rational state or input precision.
Definition mpreal_functions.hpp:205
exact_rational pow(X const &base, Y const &power)
Evaluate a rational power exactly when its real result is rational.
Definition exact_rational.hpp:337
sinhcosh_result< mpreal > sinhcosh(mpreal const &x)
Evaluate hyperbolic sine and cosine using the paired provider routine.
Definition mpreal_functions.hpp:591
mpreal asinh(mpreal const &x)
Inverse hyperbolic sine; retain input precision or a supported exact result.
Definition mpreal.hpp:785
mpreal acospi(mpreal const &x)
Principal arccosine divided by pi.
Definition mpreal_extensions.hpp:150
mpreal ceil(mpreal const &x)
Round toward positive infinity; exact inputs produce exact integers.
Definition mpreal_functions.hpp:72
mpreal asin(mpreal const &x)
Inverse sine in radians; retain input precision or a supported exact result.
Definition mpreal.hpp:750
mpreal beta(mpreal const &a, mpreal const &x)
Real Beta function; positive rational/integer pairs retain exact values.
Definition mpreal_special.hpp:164
mpreal remainder(mpreal const &a, mpreal const &b)
Nearest-even-quotient remainder; exact operands retain exact rational results.
Definition mpreal_functions.hpp:534
mpreal atanh(mpreal const &x)
Inverse hyperbolic tangent; retain input precision or a supported exact result.
Definition mpreal.hpp:799
mpreal atanpi(mpreal const &x)
Principal arctangent divided by pi.
Definition mpreal_extensions.hpp:155
remquo_result< mpreal > remquo(mpreal const &a, mpreal const &b)
Nearest-even remainder with the signed low three quotient bits.
Definition mpreal_functions.hpp:546
mpcomplex exp(mpcomplex const &z)
Definition mpcomplex.hpp:503
mpreal csch(mpreal const &x)
Reciprocal hyperbolic sine, evaluated directly by MPFR.
Definition mpreal_extensions.hpp:180
mpreal tanpi(mpreal const &x)
Tangent of pi times x, with provider argument reduction.
Definition mpreal_extensions.hpp:140
mpreal exp2m1(mpreal const &x)
Two to the power x minus one, using the cancellation-safe provider.
Definition mpreal_extensions.hpp:110
mpreal atan2(mpreal const &y, mpreal const &x)
Definition mpreal.hpp:659
std::int64_t ilogb(mpreal const &x)
Base-two exponent of a finite nonzero value.
Definition mpreal_functions.hpp:515
mpcomplex sin(mpcomplex const &z)
Definition mpcomplex.hpp:506
mpreal copysign(mpreal const &magnitude, mpreal const &sign)
Transfer the sign while preserving the magnitude's precision and exactness.
Definition mpreal_functions.hpp:224
mpreal digamma(mpreal const &x)
Logarithmic derivative of Gamma; finite working precision is required.
Definition mpreal_special.hpp:129
mpreal floor(mpreal const &x)
Round toward negative infinity; exact inputs produce exact integers.
Definition mpreal_functions.hpp:59
mpreal log1p(mpreal const &x)
Logarithm of one plus x without cancellation; retain input precision or exact zero.
Definition mpreal.hpp:743
mpreal sinpi(mpreal const &x)
Sine of pi times x, with provider argument reduction.
Definition mpreal_extensions.hpp:130
mpreal log10p1(mpreal const &x)
Base-ten logarithm of one plus x, without rounding the sum first.
Definition mpreal_extensions.hpp:125
mpreal bessel_y(I n, mpreal const &x)
Bessel function of the second kind, with a checked signed integer order.
Definition mpreal_special.hpp:239
mpreal lgamma(mpreal const &x)
Natural logarithm of abs(Gamma(x)), including negative Gamma values.
Definition mpreal_special.hpp:205
mpcomplex cos(mpcomplex const &z)
Definition mpcomplex.hpp:507
Project-level numeric limits customization point.
Definition numeric_limits.hpp:16