19struct mpcomplex_access;
21inline mpfr_prec_t mpfr_precision(Precision
p)
23 auto bits =
p.bit_count();
24 if (bits < MPFR_PREC_MIN || bits > MPFR_PREC_MAX)
throw std::invalid_argument(
"MPFR: unsupported significand size");
25 return static_cast<mpfr_prec_t
>(bits);
27inline void require_mpfr_tls()
29 static bool const supported = mpfr_buildopt_tls_p() != 0;
30 if (!supported)
throw std::runtime_error(
"uni20::mpreal requires a thread-safe MPFR build");
38 bool initialized =
false;
39 explicit mpfr_value(Precision
p)
42 mpfr_init2(value, mpfr_precision(
p));
44 mpfr_set_zero(value, 1);
46 mpfr_value(mpfr_value
const& other) : mpfr_value(Precision::bits(mpfr_get_prec(other.
value)))
48 mpfr_set(value, other.value, MPFR_RNDN);
50 mpfr_value(mpfr_value&& other)
noexcept
52 std::swap(value[0], other.value[0]);
53 std::swap(initialized, other.initialized);
55 mpfr_value& operator=(mpfr_value other)
noexcept
57 std::swap(value[0], other.value[0]);
58 std::swap(initialized, other.initialized);
63 if (initialized) mpfr_clear(value);
86 value_.emplace<detail::mpfr_value>(
p);
96 template <std::
integral I>
97 requires(!std::same_as<I, bool>)
104 if (
p.is_exact() ||
text.find(
'/') != std::string_view::npos)
109 if (
text.
empty() ||
text.find(
'\0') != std::string_view::npos ||
110 text.find_first_of(
" \t\r\n\f\v") != std::string_view::npos)
111 throw std::invalid_argument(
"mpreal: expected a complete decimal value");
112 std::string owned(
text);
114 mpfr_strtofr(this->approximate(), owned.c_str(), &end, 10, MPFR_RNDN);
115 if (end != owned.c_str() + owned.size() || end == owned.c_str())
116 throw std::invalid_argument(
"mpreal: invalid decimal value");
124 mpfr_set_q(this->approximate(), rational, MPFR_RNDN);
127 template <std::
integral I>
128 requires(!std::same_as<I, bool>)
137 requires(std::same_as<F, float> || std::same_as<F, double> || std::same_as<F, long double>)
140 mpfr_set_ld(this->approximate(),
static_cast<long double>(
value), MPFR_RNDN);
142#if UNI20_HAS_FLOAT128
145 requires std::same_as<F, float128>
148 mpfr_set_float128(this->approximate(),
value, MPFR_RNDN);
155 other.require_value();
158 if (!other.
is_exact())
throw std::invalid_argument(
"mpreal: an approximation cannot be reclassified as exact");
162 other.
copy_to(this->approximate());
166 mpreal(
mpreal&& other) noexcept : value_(std::move(other.value_)) { other.value_.emplace<std::monostate>(); }
172 void swap(
mpreal& other)
noexcept { value_.swap(other.value_); }
174 bool initialized() const noexcept {
return !std::holds_alternative<std::monostate>(value_); }
176 bool is_exact() const noexcept {
return std::holds_alternative<exact_rational>(value_); }
180 this->require_value();
186 this->require_value();
187 if (this->
is_exact())
throw std::logic_error(
"mpreal: exact value needs finite precision before MPFR access");
188 return std::get<detail::mpfr_value>(value_).value;
193 this->require_value();
194 if (!this->
is_exact())
throw std::logic_error(
"mpreal: value is approximate");
195 return std::get<exact_rational>(value_);
200 this->require_value();
208 explicit operator float()
const {
return this->to_native<float, mpfr_get_flt>(); }
209 explicit operator double()
const {
return this->to_native<double, mpfr_get_d>(); }
210 explicit operator long double()
const {
return this->to_native<long double, mpfr_get_ld>(); }
211#if UNI20_HAS_FLOAT128
213 explicit operator float128()
const {
return this->to_native<float128, mpfr_get_float128>(113); }
223 if (mpfr_nan_p(
value))
return "nan";
224 if (mpfr_inf_p(
value))
return mpfr_signbit(
value) ?
"-inf" :
"inf";
225 if (mpfr_zero_p(
value))
return mpfr_signbit(
value) ?
"-0" :
"0";
227 std::unique_ptr<char,
decltype(&mpfr_free_str)>
text(
228 mpfr_get_str(
nullptr, &exponent, 10, digits,
value, MPFR_RNDN), &mpfr_free_str);
229 if (!
text)
throw std::bad_alloc();
230 std::string_view mantissa(
text.get());
232 if (mantissa.front() ==
'-')
235 mantissa.remove_prefix(1);
237 result += mantissa.front();
238 if (mantissa.size() > 1)
241 result += mantissa.substr(1);
244 result += std::to_string(exponent - 1);
259 friend struct detail::mpreal_access;
260 friend struct detail::mpcomplex_access;
263 this->require_value();
267 auto bits =
static_cast<mpfr_prec_t
>(digits + 16);
271 mpfr_set_q(lower.value, this->exact_value().native_handle(), MPFR_RNDD);
272 mpfr_set_q(upper.value, this->exact_value().native_handle(), MPFR_RNDU);
273 F lo = Convert(lower.value, MPFR_RNDN), hi = Convert(upper.value, MPFR_RNDN);
274 if (lo == hi)
return lo;
275 if (bits > MPFR_PREC_MAX / 2)
throw std::overflow_error(
"mpreal: native conversion precision exhausted");
279 void require_value()
const
281 if (!this->
initialized())
throw std::logic_error(
"mpreal: numerical use of an unset value");
283 mpfr_ptr approximate()
286 return std::get<detail::mpfr_value>(value_).value;
288 std::variant<std::monostate, exact_rational, detail::mpfr_value> value_;
298 static constexpr bool is_specialized =
true;
299 static constexpr bool is_signed =
true;
300 static constexpr bool is_integer =
false;
302 static constexpr bool is_bounded =
false;
303 static constexpr bool is_iec559 =
false;
304 static constexpr int radix = 2;
305 static constexpr bool has_infinity =
true;
306 static constexpr bool has_quiet_NaN =
true;
328 operation(result.approximate());
331 template <
class F>
static exact_rational rational_result(F&& operation)
334 operation(result.value_);
335 mpq_canonicalize(result.value_);
339 static bool can_expand_rational(
mpreal const& x)
342 auto bound = std::max<mpfr_prec_t>(4096, mpfr_get_prec(x.
native_handle()));
344 return exponent >= -bound && exponent <= bound;
346 static scaled_rational stored_scaled(
mpreal const& x)
349 scaled_rational result;
351 result.exponent = mpfr_get_z_2exp(mpq_numref(result.coefficient.value_), x.
native_handle());
366 auto const& real = a.
is_exact() ? b : a;
374 auto r = real.native_handle();
376 Operation(result.approximate(), a.
is_exact() ? zero : r, a.
is_exact() ? r : zero, MPFR_RNDN);
379 if constexpr (same_function_v<Operation, mpfr_add>)
380 mpfr_add_q(result.approximate(), real.native_handle(), q, MPFR_RNDN);
381 else if constexpr (same_function_v<Operation, mpfr_mul>)
382 mpfr_mul_q(result.approximate(), real.native_handle(), q, MPFR_RNDN);
383 else if constexpr (same_function_v<Operation, mpfr_sub>)
388 mpfr_neg(result.approximate(), real.native_handle(), MPFR_RNDN);
389 mpfr_add_q(result.approximate(), result.
native_handle(), q, MPFR_RNDN);
392 mpfr_sub_q(result.approximate(), real.native_handle(), q, MPFR_RNDN);
394 else if constexpr (same_function_v<Operation, mpfr_div>)
397 mpfr_div_q(result.approximate(), real.native_handle(), q, MPFR_RNDN);
398 else if (mpfr_number_p(real.native_handle()) && !mpfr_zero_p(real.native_handle()) && rational != 0)
400 if (can_expand_rational(real))
401 result =
mpreal(rational / stored_rational(real),
p);
403 scaled_rational_ratio({stored_scaled(a), {}, stored_scaled(b), {}}).round_to(result.approximate());
409 mpfr_set_si(result.approximate(), mpq_sgn(q), MPFR_RNDN);
410 mpfr_div(result.approximate(), result.
native_handle(), real.native_handle(), MPFR_RNDN);
423 mpz_set_ui(factor.value, base);
424 auto numerator_power = mpz_remove(
remainder.value, mpq_numref(q), factor.value);
427 auto denominator_power = mpz_remove(
remainder.value, mpq_denref(q), factor.value);
432 throw std::logic_error(
"mpreal: logarithm requires finite working precision");
439 return apply<Operation>(x.
at(
p));
444 return apply<Operation>(x.
at(
p), y.
at(
p));
447 template <auto Operation>
static mpreal apply(
mpreal const& x)
452 if constexpr (same_function_v<Operation, mpfr_neg>)
454 else if constexpr (same_function_v<Operation, mpfr_abs>)
456 else if constexpr (same_function_v<Operation, mpfr_sqrt>)
458 else if constexpr (same_function_v<Operation, mpfr_cbrt>)
461 throw std::logic_error(
"mpreal: cube root requires finite working precision");
463 else if constexpr (same_function_v<Operation, mpfr_exp2>)
465 else if constexpr (same_function_v<Operation, mpfr_log2>)
467 else if constexpr (same_function_v<Operation, mpfr_log10>)
472 if constexpr (same_function_v<Operation, mpfr_exp> || same_function_v<Operation, mpfr_cos> ||
473 same_function_v<Operation, mpfr_cosh>)
475 if (q == 0)
return mpreal{1};
477 else if constexpr (same_function_v<Operation, mpfr_log> || same_function_v<Operation, mpfr_acos> ||
478 same_function_v<Operation, mpfr_acosh>)
480 if (q == 1)
return mpreal{};
482 else if constexpr (same_function_v<Operation, mpfr_sin> || same_function_v<Operation, mpfr_tan> ||
483 same_function_v<Operation, mpfr_atan> || same_function_v<Operation, mpfr_expm1> ||
484 same_function_v<Operation, mpfr_log1p> || same_function_v<Operation, mpfr_asin> ||
485 same_function_v<Operation, mpfr_sinh> || same_function_v<Operation, mpfr_tanh> ||
486 same_function_v<Operation, mpfr_asinh> || same_function_v<Operation, mpfr_atanh>)
488 if (q == 0)
return mpreal{};
490 throw std::logic_error(
"mpreal: elementary function requires finite working precision");
494 Operation(result.approximate(), x.
native_handle(), MPFR_RNDN);
502 if constexpr (same_function_v<Operation, mpfr_add>)
504 else if constexpr (same_function_v<Operation, mpfr_sub>)
506 else if constexpr (same_function_v<Operation, mpfr_mul>)
508 else if constexpr (same_function_v<Operation, mpfr_div>)
510 else if constexpr (same_function_v<Operation, mpfr_pow>)
512 else if constexpr (same_function_v<Operation, mpfr_hypot>)
516 if constexpr (same_function_v<Operation, mpfr_atan2>)
518 throw std::logic_error(
"mpreal: elementary function requires finite working precision");
521 if constexpr (same_function_v<Operation, mpfr_add> || same_function_v<Operation, mpfr_sub> ||
522 same_function_v<Operation, mpfr_mul> || same_function_v<Operation, mpfr_div>)
540 a = apply<Operation>(a, b);
547 Operation(result.approximate(), MPFR_RNDN);
556inline mpreal operator+(
mpreal const& a,
mpreal const& b) {
return detail::mpreal_access::apply<mpfr_add>(a, b); }
594 if (mpfr_nan_p(b.
native_handle()))
return std::partial_ordering::unordered;
599 if (mpfr_nan_p(a.
native_handle()))
return std::partial_ordering::unordered;
611template <std::
integral I>
int compare_integer(mpreal
const& a, I b)
613 if constexpr (std::is_signed_v<I> && std::numeric_limits<I>::digits <= std::numeric_limits<long>::digits)
614 return mpfr_cmp_si(a.native_handle(),
static_cast<long>(b));
615 else if constexpr (!std::is_signed_v<I> &&
616 std::numeric_limits<I>::digits <= std::numeric_limits<unsigned long>::digits)
617 return mpfr_cmp_ui(a.native_handle(),
static_cast<unsigned long>(b));
619 return mpfr_cmp_q(a.native_handle(), exact_rational(b).native_handle());
623template <std::
integral I>
624 requires(!std::same_as<I, bool>)
625inline bool operator==(
mpreal const& a, I b)
629 return mpfr_number_p(a.
native_handle()) && detail::compare_integer(a, b) == 0;
631template <std::
integral I>
632 requires(!std::same_as<I, bool>)
636 if (mpfr_nan_p(a.
native_handle()))
return std::partial_ordering::unordered;
637 return detail::compare_integer(a, b) <=> 0;
651inline mpreal abs(
mpreal const& x) {
return detail::mpreal_access::apply<mpfr_abs>(x); }
653inline mpreal exp(
mpreal const& x) {
return detail::mpreal_access::apply<mpfr_exp>(x); }
654inline mpreal log(
mpreal const& x) {
return detail::mpreal_access::apply<mpfr_log>(x); }
655inline mpreal sin(
mpreal const& x) {
return detail::mpreal_access::apply<mpfr_sin>(x); }
656inline mpreal cos(
mpreal const& x) {
return detail::mpreal_access::apply<mpfr_cos>(x); }
657inline mpreal tan(
mpreal const& x) {
return detail::mpreal_access::apply<mpfr_tan>(x); }
691 return detail::mpreal_access::apply<mpfr_atan2>(y, x,
p);
697 return detail::mpreal_access::apply<mpfr_hypot>(x, y,
p);
703 return detail::mpreal_access::apply<mpfr_pow>(x, y,
p);
810 mpfr_set_ui_2exp(result.approximate(), 1, 1 - precision.
bit_count(), MPFR_RNDN);
818template <auto Prov
ider>
struct mp_constant
821 friend mpreal operator+(mpreal
const& x, mp_constant
c) {
return x +
c.at(x.precision()); }
822 friend mpreal
operator-(mpreal
const& x, mp_constant
c) {
return x -
c.at(x.precision()); }
823 friend mpreal
operator*(mpreal
const& x, mp_constant
c) {
return x *
c.at(x.precision()); }
824 friend mpreal
operator/(mpreal
const& x, mp_constant
c) {
return x /
c.at(x.precision()); }
825 friend mpreal
operator+(mp_constant
c, mpreal
const& x) {
return c.at(x.precision()) + x; }
826 friend mpreal
operator-(mp_constant
c, mpreal
const& x) {
return c.at(x.precision()) - x; }
827 friend mpreal
operator*(mp_constant
c, mpreal
const& x) {
return c.at(x.precision()) * x; }
828 friend mpreal
operator/(mp_constant
c, mpreal
const& x) {
return c.at(x.precision()) / x; }
830template <>
struct math_constants<mpreal>
832 static constexpr mp_constant<mpfr_const_pi>
pi{};
833 static constexpr mp_constant<mpfr_const_log2>
log_two{};
834 static constexpr mp_constant<mpfr_const_euler>
euler_gamma{};
835 static constexpr mp_constant<mpfr_const_catalan>
catalan{};
Exact arithmetic or an explicit binary working precision.
Definition core/precision.hpp:13
static constexpr Precision bits(bit_count_type count)
Select a positive binary significand size.
Definition core/precision.hpp:21
constexpr bit_count_type bit_count() const
Number of binary significand bits.
Definition core/precision.hpp:43
static constexpr Precision exact() noexcept
No approximation has been selected; rational arithmetic remains exact.
Definition core/precision.hpp:17
A precisionless decimal spelling produced by the _mp literal operator.
Definition exact_rational.hpp:27
mpreal at(Precision precision) const
Materialize the literal with one rounding to the requested precision.
Definition mpreal.hpp:554
Owning arbitrary-size rational with exact, eager arithmetic.
Definition exact_rational.hpp:161
std::string to_string() const
Return the canonical numerator/denominator, or an integer when exact.
Definition exact_rational.hpp:225
mpreal at(Precision precision) const
Convert to a real value with one rounding at explicit precision.
Definition mpreal.hpp:553
mpq_srcptr native_handle() const
Borrow the read-only GMP rational while this object retains its payload.
Definition exact_rational.hpp:218
Owning exact rational or finite-precision MPFR real, with eager arithmetic.
Definition mpreal.hpp:74
mpreal(Precision p)
Construct zero at finite precision, or exact zero.
Definition mpreal.hpp:81
mpreal(F value, Precision p)
Import float, double or long double; precision must be finite.
Definition mpreal.hpp:138
mpreal at(Precision p) const
Definition mpreal.hpp:206
mpreal()
Construct exact zero for ordinary generic accumulators.
Definition mpreal.hpp:77
mpreal(exact_rational const &value, Precision p)
Definition mpreal.hpp:118
mpreal(decimal_literal value, Precision p)
Definition mpreal.hpp:126
mpreal & operator-=(mpreal const &rhs)
Definition mpreal.hpp:578
mpreal(I value, Precision p)
Definition mpreal.hpp:129
mpreal(mpreal const &)=default
mpreal(mpreal &&other) noexcept
Transfer ownership, leaving the source unset.
Definition mpreal.hpp:166
mpfr_srcptr native_handle() const
Borrow an approximate MPFR value; exact and unset states require explicit materialization first.
Definition mpreal.hpp:184
mpreal(exact_rational value)
Retain an exact rational without rounding.
Definition mpreal.hpp:90
std::string to_string(std::size_t digits=0) const
Format exact rationals as numerator/denominator and approximations as decimal scientific notation.
Definition mpreal.hpp:219
mpreal & operator+=(mpreal const &rhs)
Definition mpreal.hpp:577
mpreal(std::string_view text, Precision p)
Parse a complete decimal or integer fraction at the requested precision.
Definition mpreal.hpp:102
mpreal & operator=(mpreal other) noexcept
Definition mpreal.hpp:167
bool is_exact() const noexcept
Whether the active payload is an exact rational.
Definition mpreal.hpp:176
mpreal(mpfr_srcptr value, Precision p)
Copy a valid borrowed MPFR value, rounding at finite precision.
Definition mpreal.hpp:134
mpreal(I value)
Definition mpreal.hpp:98
mpreal(mpreal const &other, Precision p)
Convert to finite precision, or retain an already-exact value in exact mode.
Definition mpreal.hpp:153
mpreal(uninitialized_t) noexcept
Construct an unset placeholder for overwrite storage.
Definition mpreal.hpp:79
void copy_to(mpfr_ptr destination) const
Round into an initialized MPFR destination at its existing precision.
Definition mpreal.hpp:198
friend mpreal epsilon(Precision precision)
Spacing above one for a specified binary working precision.
Definition mpreal.hpp:805
mpreal & operator/=(mpreal const &rhs)
Definition mpreal.hpp:580
bool initialized() const noexcept
Whether this object holds an exact or approximate numerical value.
Definition mpreal.hpp:174
Precision precision() const
Return exact state or the working precision stored by MPFR.
Definition mpreal.hpp:178
void swap(mpreal &other) noexcept
Definition mpreal.hpp:172
exact_rational const & exact_value() const
Borrow the exact rational; valid while this object retains its state.
Definition mpreal.hpp:191
mpreal & operator*=(mpreal const &rhs)
Definition mpreal.hpp:579
mpreal(decimal_literal value)
Definition mpreal.hpp:95
bool empty() const noexcept
Return whether this document has no spans.
Definition presentation.cpp:1182
locale_t value
Definition data_table.cpp:49
presentation::styled_text text
Definition display.cpp:141
auto operator-(Async< T > const &x)
Unary negation overload for Async values.
Definition async_ops.hpp:477
uni20::complex< T > conj(detail::standard_complex< T > x)
Returns the complex conjugate for complex-valued scalars.
Definition math.hpp:70
constexpr bool isfinite(I const &x) noexcept
Returns whether an integer scalar is finite.
Definition math.hpp:121
Var< T > operator*(T x, Var< T > y)
Computes x * y with reverse-mode gradient propagation.
Definition var_toys.hpp:176
Var< T > operator+(Var< T > x, T y)
Computes x + y with reverse-mode gradient propagation.
Definition var_toys.hpp:136
Definition data_table.cpp:8
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
constexpr auto pi
Pi as a native constant or a precision-aware MPFR descriptor.
Definition math_constants.hpp:37
bool isnan(mpcomplex const &z)
Definition mpcomplex.hpp:499
constexpr uninitialized_t uninitialized
Explicit allocation tag for overwrite outputs and scratch space.
Definition common/initialization.hpp:22
constexpr auto operator*(basic_half_int< T > lhs, U rhs) -> basic_half_int< T >
Multiply a half-integer value by an integral scalar.
Definition half_int.hpp:367
mpreal tan(mpreal const &x)
Definition mpreal.hpp:657
auto operator<<(std::ostream &out, basic_half_int< T > value) -> std::ostream &
Stream a half-integer in integer or .5 decimal form.
Definition half_int.hpp:515
mpcomplex sinh(mpcomplex const &z)
Hyperbolic sine at the input precision; exact zero remains exact.
Definition mpcomplex.hpp:509
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 expm1(mpreal const &x)
Exponential minus one without cancellation; retain input precision or exact zero.
Definition mpreal.hpp:722
mpreal atan(mpreal const &x)
Definition mpreal.hpp:658
bool operator==(exact_rational const &a, exact_rational const &b)
Definition exact_rational.hpp:284
exact_rational sqrt(X const &value)
Return the nonnegative rational square root, or require finite precision.
Definition exact_rational.hpp:355
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
constexpr auto operator-(basic_half_int< T > lhs, basic_half_int< T > rhs) -> basic_half_int< T >
Subtract two half-integer values.
Definition half_int.hpp:345
mpcomplex cosh(mpcomplex const &z)
Hyperbolic cosine at the input precision; exact zero returns exact one.
Definition mpcomplex.hpp:511
mpreal tanh(mpreal const &x)
Hyperbolic tangent; retain input precision or a supported exact result.
Definition mpreal.hpp:778
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 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
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 epsilon(Precision precision)
Spacing above one for a specified binary working precision.
Definition mpreal.hpp:805
constexpr Precision common_precision(Precision a, Precision b)
Combine precisions, treating exact values as neutral and rejecting unequal finite precisions.
Definition core/precision.hpp:57
std::optional< exact_rational > rational_root(exact_rational const &x, unsigned long degree)
Return a rational nth root when it exists, without choosing a precision.
Definition exact_rational.hpp:296
mpreal hypot(mpreal const &x, mpreal const &y)
Definition mpreal.hpp:660
bool signbit(mpreal const &x)
Definition mpreal.hpp:642
constexpr auto euler_gamma
Euler-Mascheroni constant, with the same type and precision rules as pi.
Definition math_constants.hpp:47
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
mpreal asinh(mpreal const &x)
Inverse hyperbolic sine; retain input precision or a supported exact result.
Definition mpreal.hpp:785
mpreal asin(mpreal const &x)
Inverse sine in radians; retain input precision or a supported exact result.
Definition mpreal.hpp:750
constexpr auto catalan
Catalan constant as a native value or a precision-aware MPFR descriptor.
Definition math_constants.hpp:52
constexpr auto log_two
Natural logarithm of two, with the same type and precision rules as pi.
Definition math_constants.hpp:42
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
mpcomplex exp(mpcomplex const &z)
Definition mpcomplex.hpp:503
mpreal atan2(mpreal const &y, mpreal const &x)
Definition mpreal.hpp:659
constexpr auto operator/(basic_half_int< T > lhs, U rhs) -> U
Divide a half-integer value by a floating-point scalar.
Definition half_int.hpp:422
mpcomplex sin(mpcomplex const &z)
Definition mpcomplex.hpp:506
std::strong_ordering operator<=>(exact_rational const &a, exact_rational const &b)
Definition exact_rational.hpp:288
mpreal log1p(mpreal const &x)
Logarithm of one plus x without cancellation; retain input precision or exact zero.
Definition mpreal.hpp:743
mpcomplex cos(mpcomplex const &z)
Definition mpcomplex.hpp:507
static mpfr_prec_t digits(mpreal const &x)
Definition mpreal.hpp:310
static mpreal epsilon(mpreal const &x)
Definition mpreal.hpp:315
static mpreal epsilon()=delete
static mpfr_prec_t digits(Precision p)
Significand bits at a finite working precision.
Definition mpreal.hpp:309
Project-level numeric limits customization point.
Definition numeric_limits.hpp:16
Request storage whose numerical values must be written before being read.
Definition common/initialization.hpp:17