|
template<typename T > |
constexpr auto | cbrt (T x) |
| Calculate cubic root \( \sqrt[3]{x} \).
|
|
template<typename T > |
constexpr auto | ceil (T x) -> T |
| Calculate the smallest integer not less than x, \( \lceil x \rceil
\).
|
|
template<typename T , typename = std::enable_if_t<std::is_floating_point_v<T>>> |
constexpr auto | exp (T x) -> T |
| Calculate exponential function \( e^x \).
|
|
template<typename T , typename = std::enable_if_t<std::is_floating_point_v<T>>> |
constexpr auto | expm1 (T x) -> T |
| Calculate exponential function minus one \( e^x - 1 \).
|
|
template<typename T > |
constexpr auto | floor (T x) -> T |
| Calculate the largest integer not greater than x, \( \lfloor x
\rfloor \).
|
|
template<typename T , typename = std::enable_if_t<std::is_floating_point_v<T>>> |
constexpr auto | log (T x) -> T |
| Calculate logarithm \( \log(x) \).
|
|
template<typename T , typename = std::enable_if_t<std::is_floating_point_v<T>>> |
constexpr auto | log1p (T x) -> T |
| Calculate natural logarithm of 1 + x, \( \log(1 + x) \).
|
|
template<typename B , typename E , std::enable_if_t< std::is_integral_v< E >, void * > = nullptr> |
constexpr auto | pow (B base, E exp) -> B |
| Calculate power \( {base}^{exp} \).
|
|
template<typename T , std::enable_if_t< std::is_floating_point_v< T >, void * > = nullptr> |
constexpr auto | pow (T base, T exp) -> T |
| Calculate power \( {base}^{exp} \).
|
|
template<typename F , typename I , std::enable_if_t< std::is_floating_point_v< F > &&std::is_integral_v< I >, void * > = nullptr> |
constexpr auto | root (F x, I n) -> F |
| Calculate n-th root \( \sqrt[n]{x} \).
|
|
template<typename IB , typename IE , std::enable_if_t< std::is_integral_v< IB > &&std::is_integral_v< IE >, void * > = nullptr> |
constexpr auto | root (IB x, IE n) -> double |
| Calculate n-th root \( \sqrt[n]{x} \).
|
|
template<typename F , std::enable_if_t< std::is_floating_point_v< F >, void * > = nullptr> |
constexpr auto | sqrt (F x) -> F |
| Calculate square root \( \sqrt{x} \).
|
|
template<typename I , std::enable_if_t< std::is_integral_v< I >, void * > = nullptr> |
constexpr auto | sqrt (I x) -> double |
| Calculate square root \( \sqrt{x} \).
|
|
template<typename T > |
constexpr auto | trunc (T x) -> T |
| Truncate the decimal part of a number x.
|
|
Namespace of constexpr variables and functions.
template<typename T , typename = std::enable_if_t<std::is_floating_point_v<T>>>
auto num_collect::constants::exp |
( |
T | x | ) |
-> T |
|
constexpr |
Calculate exponential function \( e^x \).
This function calculates similar values as exp function in C++ standard library in constexpr.
- Template Parameters
-
- Parameters
-
- Returns
- Exponential function value.
Definition at line 46 of file exp.h.
template<typename T , typename = std::enable_if_t<std::is_floating_point_v<T>>>
auto num_collect::constants::expm1 |
( |
T | x | ) |
-> T |
|
constexpr |
Calculate exponential function minus one \( e^x - 1 \).
This function calculates similar values as expm1 function in C++ standard library in constexpr.
This function has following optimization for small values:
- for \( 0 \le x \le 1 \), Maclaurin series for \( e^x - 1 \) is used.
- for \( -1 \le x < 0 \), \( e^x - 1 = - (e^{-x} - 1) / e^{-x} \) is calculated.
- Template Parameters
-
- Parameters
-
- Returns
- Exponential function minus one.
Definition at line 49 of file expm1.h.
template<typename T , typename = std::enable_if_t<std::is_floating_point_v<T>>>
auto num_collect::constants::log |
( |
T | x | ) |
-> T |
|
constexpr |
Calculate logarithm \( \log(x) \).
This function calculates similar values as log function in C++ standard library in constexpr.
- Template Parameters
-
- Parameters
-
- Returns
- Logarithm
Definition at line 43 of file log.h.
template<typename T , typename = std::enable_if_t<std::is_floating_point_v<T>>>
auto num_collect::constants::log1p |
( |
T | x | ) |
-> T |
|
constexpr |
Calculate natural logarithm of 1 + x, \( \log(1 + x) \).
This function calculates similar values as log1p function in C++ standard library in constexpr.
This function can calculate natural logarithm of numbers near to 1 more accurately.
- Template Parameters
-
- Parameters
-
- Returns
- Logarithm of 1 - x.
Definition at line 47 of file log1p.h.
template<typename B , typename E , std::enable_if_t< std::is_integral_v< E >, void * > = nullptr>
auto num_collect::constants::pow |
( |
B | base, |
|
|
E | exp ) -> B |
|
constexpr |
Calculate power \( {base}^{exp} \).
This function calculates similar values as pow function in C++ standard library in constexpr.
- Template Parameters
-
B | Base type. |
E | Exponent type. |
- Parameters
-
[in] | base | Base. |
[in] | exp | Exponent. |
- Returns
- Power.
Definition at line 47 of file pow.h.
template<typename T , std::enable_if_t< std::is_floating_point_v< T >, void * > = nullptr>
auto num_collect::constants::pow |
( |
T | base, |
|
|
T | exp ) -> T |
|
constexpr |
Calculate power \( {base}^{exp} \).
This function calculates similar values as pow function in C++ standard library in constexpr.
- Template Parameters
-
- Parameters
-
[in] | base | Base. |
[in] | exp | Exponent. |
- Returns
- Power.
Definition at line 70 of file pow.h.
template<typename F , typename I , std::enable_if_t< std::is_floating_point_v< F > &&std::is_integral_v< I >, void * > = nullptr>
auto num_collect::constants::root |
( |
F | x, |
|
|
I | n ) -> F |
|
constexpr |
Calculate n-th root \( \sqrt[n]{x} \).
- Template Parameters
-
F | Value type. |
I | Integer type for n. |
- Parameters
-
[in] | x | Value to calculate n-th root of. |
[in] | n | Exponent. |
- Returns
- n-th root of x.
Definition at line 44 of file root.h.
template<typename IB , typename IE , std::enable_if_t< std::is_integral_v< IB > &&std::is_integral_v< IE >, void * > = nullptr>
auto num_collect::constants::root |
( |
IB | x, |
|
|
IE | n ) -> double |
|
constexpr |
Calculate n-th root \( \sqrt[n]{x} \).
- Template Parameters
-
IB | Value type. |
IE | Integer type for n. |
- Parameters
-
[in] | x | Value to calculate n-th root of. |
[in] | n | Exponent. |
- Returns
- n-th root of x.
Definition at line 86 of file root.h.
template<typename F , std::enable_if_t< std::is_floating_point_v< F >, void * > = nullptr>
auto num_collect::constants::sqrt |
( |
F | x | ) |
-> F |
|
constexpr |
Calculate square root \( \sqrt{x} \).
This function calculates similar values as sqrt function in C++ standard library in constexpr.
- Template Parameters
-
- Parameters
-
[in] | x | Value to calculate square root of. |
- Returns
- Square root.
Definition at line 44 of file sqrt.h.
template<typename I , std::enable_if_t< std::is_integral_v< I >, void * > = nullptr>
auto num_collect::constants::sqrt |
( |
I | x | ) |
-> double |
|
constexpr |
Calculate square root \( \sqrt{x} \).
This function calculates similar values as sqrt function in C++ standard library in constexpr.
- Template Parameters
-
- Parameters
-
[in] | x | Value to calculate square root of. |
- Returns
- Square root.
Definition at line 78 of file sqrt.h.