CDT++ 1.0.0
Causal Dynamical Triangulations in C++
Loading...
Searching...
No Matches
Mpfr_value.hpp File Reference

Scope-owned, value-returning MPFR operations. More...

#include <CGAL/Gmpfr.h>
#include <stdexcept>
#include <type_traits>
#include "Settings.hpp"
Include dependency graph for Mpfr_value.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  cdt
 clang-15 does not support std::format

Typedefs

using cdt::mpfr_values::Value = CGAL::Gmpfr
 Owning arbitrary-precision floating-point value used by CDT++.

Functions

auto cdt::mpfr_values::add (Value const &left, Value const &right) -> Value
auto cdt::mpfr_values::arc_cosine (Value const &value) -> Value
auto cdt::mpfr_values::divide (Value const &numerator, Value const &denominator) -> Value
auto cdt::mpfr_values::exponential (Value const &value) -> Value
auto cdt::mpfr_values::from_decimal (char const *value) -> Value
auto cdt::mpfr_values::from_integer (long const value) -> Value
auto cdt::mpfr_values::from_long_double (long double const value) -> Value
auto cdt::mpfr_values::inverse_hyperbolic_sine (Value const &value) -> Value
auto cdt::mpfr_values::multiply (Value const &left, Value const &right) -> Value
auto cdt::mpfr_values::negate (Value const &value) -> Value
auto cdt::mpfr_values::pi () -> Value
auto cdt::mpfr_values::square_root (Value const &value) -> Value
auto cdt::mpfr_values::subtract (Value const &left, Value const &right) -> Value
auto cdt::mpfr_values::to_double (Value const &value) -> double
auto cdt::mpfr_values::to_long_double (Value const &value) -> long double
auto cdt::mpfr_values::zero () -> Value

Variables

constexpr auto cdt::mpfr_values::precision
 Precision in bits assigned to values created by this namespace.
constexpr auto cdt::mpfr_values::rounding_mode = MPFR_RNDN

Detailed Description

Scope-owned, value-returning MPFR operations.

Definition in file Mpfr_value.hpp.

Typedef Documentation

◆ Value

using cdt::mpfr_values::Value = CGAL::Gmpfr

Owning arbitrary-precision floating-point value used by CDT++.

Definition at line 23 of file Mpfr_value.hpp.

Function Documentation

◆ add()

auto cdt::mpfr_values::add ( Value const & left,
Value const & right ) -> Value
inlinenodiscard
Parameters
leftLeft operand.
rightRight operand.
Returns
left + right rounded according to rounding_mode.

Definition at line 89 of file Mpfr_value.hpp.

◆ arc_cosine()

auto cdt::mpfr_values::arc_cosine ( Value const & value) -> Value
inlinenodiscard
Parameters
valueInput value in the MPFR arccosine domain.
Returns
The MPFR arccosine of value in radians.

Definition at line 149 of file Mpfr_value.hpp.

◆ divide()

auto cdt::mpfr_values::divide ( Value const & numerator,
Value const & denominator ) -> Value
inlinenodiscard
Parameters
numeratorDividend.
denominatorDivisor.
Returns
numerator / denominator with MPFR exceptional-value semantics.

Definition at line 121 of file Mpfr_value.hpp.

◆ exponential()

auto cdt::mpfr_values::exponential ( Value const & value) -> Value
inlinenodiscard
Parameters
valueInput value.
Returns
The MPFR exponential of value.

Definition at line 167 of file Mpfr_value.hpp.

◆ from_decimal()

auto cdt::mpfr_values::from_decimal ( char const * value) -> Value
inlinenodiscard
Parameters
valueNull-terminated base-10 representation.
Returns
The parsed value at the project precision.
Exceptions
std::invalid_argumentif value is null or is not a valid MPFR decimal representation.

Definition at line 64 of file Mpfr_value.hpp.

◆ from_integer()

auto cdt::mpfr_values::from_integer ( long const value) -> Value
inlinenodiscard
Parameters
valueSigned integer to represent exactly.
Returns
value converted at the project precision.

Definition at line 44 of file Mpfr_value.hpp.

◆ from_long_double()

auto cdt::mpfr_values::from_long_double ( long double const value) -> Value
inlinenodiscard
Parameters
valueBinary floating-point value to convert.
Returns
value rounded to the project precision.

Definition at line 53 of file Mpfr_value.hpp.

◆ inverse_hyperbolic_sine()

auto cdt::mpfr_values::inverse_hyperbolic_sine ( Value const & value) -> Value
inlinenodiscard
Parameters
valueInput value.
Returns
The MPFR inverse hyperbolic sine of value.

Definition at line 140 of file Mpfr_value.hpp.

◆ multiply()

auto cdt::mpfr_values::multiply ( Value const & left,
Value const & right ) -> Value
inlinenodiscard
Parameters
leftLeft operand.
rightRight operand.
Returns
left * right rounded according to rounding_mode.

Definition at line 110 of file Mpfr_value.hpp.

◆ negate()

auto cdt::mpfr_values::negate ( Value const & value) -> Value
inlinenodiscard
Parameters
valueInput value.
Returns
The additive inverse of value.

Definition at line 158 of file Mpfr_value.hpp.

◆ pi()

auto cdt::mpfr_values::pi ( ) -> Value
inlinenodiscard
Returns
The MPFR constant pi rounded to the project precision.

Definition at line 79 of file Mpfr_value.hpp.

◆ square_root()

auto cdt::mpfr_values::square_root ( Value const & value) -> Value
inlinenodiscard
Parameters
valueInput value.
Returns
The MPFR square root of value.

Definition at line 131 of file Mpfr_value.hpp.

◆ subtract()

auto cdt::mpfr_values::subtract ( Value const & left,
Value const & right ) -> Value
inlinenodiscard
Parameters
leftLeft operand.
rightRight operand.
Returns
left - right rounded according to rounding_mode.

Definition at line 99 of file Mpfr_value.hpp.

◆ to_double()

auto cdt::mpfr_values::to_double ( Value const & value) -> double
inlinenodiscard
Parameters
valueMPFR value to narrow.
Returns
The nearest representable double under rounding_mode.

Definition at line 176 of file Mpfr_value.hpp.

◆ to_long_double()

auto cdt::mpfr_values::to_long_double ( Value const & value) -> long double
inlinenodiscard
Parameters
valueMPFR value to narrow.
Returns
The nearest representable long double under rounding_mode.

Definition at line 181 of file Mpfr_value.hpp.

◆ zero()

auto cdt::mpfr_values::zero ( ) -> Value
inlinenodiscard
Returns
An exact zero at the project precision.

Definition at line 40 of file Mpfr_value.hpp.

Variable Documentation

◆ precision

auto cdt::mpfr_values::precision
inlineconstexpr
Initial value:
=
static_cast<Value::Precision_type>(PRECISION)
constexpr Int_precision PRECISION
Sets the precision for MPFR.
Definition Settings.hpp:44

Precision in bits assigned to values created by this namespace.

Definition at line 36 of file Mpfr_value.hpp.

◆ rounding_mode

auto cdt::mpfr_values::rounding_mode = MPFR_RNDN
inlineconstexpr

MPFR round-to-nearest with ties to an even significand.

Keeping one explicit policy at every arithmetic boundary prevents a caller from accidentally mixing directed roundings inside an action calculation.

Definition at line 30 of file Mpfr_value.hpp.