Scope-owned, value-returning MPFR operations.
More...
#include <CGAL/Gmpfr.h>
#include <stdexcept>
#include <type_traits>
#include "Settings.hpp"
Go to the source code of this file.
|
| namespace | cdt |
| | clang-15 does not support std::format
|
Scope-owned, value-returning MPFR operations.
Definition in file Mpfr_value.hpp.
◆ Value
Owning arbitrary-precision floating-point value used by CDT++.
Definition at line 23 of file Mpfr_value.hpp.
◆ add()
| auto cdt::mpfr_values::add |
( |
Value const & | left, |
|
|
Value const & | right ) -> Value |
|
inlinenodiscard |
- Parameters
-
| left | Left operand. |
| right | Right 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
-
| value | Input 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
-
| numerator | Dividend. |
| denominator | Divisor. |
- 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
-
- 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
-
| value | Null-terminated base-10 representation. |
- Returns
- The parsed value at the project precision.
- Exceptions
-
| std::invalid_argument | if 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
-
| value | Signed 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
-
| value | Binary 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
-
- 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
-
| left | Left operand. |
| right | Right 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
-
- 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
-
- 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
-
| left | Left operand. |
| right | Right 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
-
| value | MPFR 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
-
| value | MPFR 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.
◆ precision
| auto cdt::mpfr_values::precision |
|
inlineconstexpr |
Initial value: =
static_cast<Value::Precision_type
>(
PRECISION)
constexpr Int_precision PRECISION
Sets the precision for MPFR.
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.