Skip to content

constants


scalar_constants class

template <typename T> scalar_constants

pi variable (scalar_constants::pi)

constexpr static T pi =
    static_cast<T>(3.1415926535897932384626433832795)

The mathematical constant π (pi).
Template param T The numeric type.

sqr_pi variable (scalar_constants::sqr_pi)

constexpr static T sqr_pi =
    static_cast<T>(9.8696044010893586188344909998762)

The square of π (pi²).
Template param T The numeric type.

recip_pi variable (scalar_constants::recip_pi)

constexpr static T recip_pi =
    static_cast<T>(0.31830988618379067153776752674503)

The reciprocal of π (1/π).
Template param T The numeric type.

degtorad variable (scalar_constants::degtorad)

constexpr static T degtorad = static_cast<T>(pi / 180)

Degrees to radians conversion factor (π / 180).
Template param T The numeric type.

radtodeg variable (scalar_constants::radtodeg)

constexpr static T radtodeg = static_cast<T>(pi * 180)

Radians to degrees conversion factor (π * 180).
Template param T The numeric type.

e variable (scalar_constants::e)

constexpr static T e =
    static_cast<T>(2.718281828459045235360287471352662)

The mathematical constant e (Euler's number).
Template param T The numeric type.

recip_log_2 variable (scalar_constants::recip_log_2)

constexpr static T recip_log_2 = static_cast<T>(
    1.442695040888963407359924681001892137426645954)

The reciprocal of the natural logarithm of 2 (1 / ln(2)).
Template param T The numeric type.

recip_log_10 variable (scalar_constants::recip_log_10)

constexpr static T recip_log_10 =
    static_cast<T>(0.43429448190325182765112891891661)

The reciprocal of the natural logarithm of 10 (1 / ln(10)).
Template param T The numeric type.

log_2 variable (scalar_constants::log_2)

constexpr static T log_2 =
    static_cast<T>(0.69314718055994530941723212145818)

The natural logarithm of 2 (ln(2)).
Template param T The numeric type.

log_10 variable (scalar_constants::log_10)

constexpr static T log_10 =
    static_cast<T>(2.3025850929940456840179914546844)

The natural logarithm of 10 (ln(10)).
Template param T The numeric type.

sqrt_2 variable (scalar_constants::sqrt_2)

constexpr static T sqrt_2 =
    static_cast<T>(1.4142135623730950488016887242097)

The square root of 2 (√2).
Template param T The numeric type.

epsilon variable (scalar_constants::epsilon)

constexpr static T epsilon =
    std::numeric_limits<T>::epsilon()

The machine epsilon — the smallest value such that 1 + epsilon ≠ 1.
Template param T The numeric type.

infinity variable (scalar_constants::infinity)

constexpr static T infinity =
    std::numeric_limits<T>::infinity()

The representation of positive infinity for the type T.
Template param T The numeric type.

neginfinity variable (scalar_constants::neginfinity)

constexpr static T neginfinity =
    -std::numeric_limits<T>::infinity()

The representation of negative infinity for the type T.
Template param T The numeric type.

qnan variable (scalar_constants::qnan)

constexpr static T qnan =
    std::numeric_limits<T>::quiet_NaN()

A quiet NaN (Not-a-Number) value for the type T. This value does not raise floating-point exceptions.
Template param T The numeric type.


constants class

template <typename T> constants

c_pi variable

template <typename T, int m = 1, int d = 1>
constexpr inline subtype<T> c_pi =
    subtype<T>(3.1415926535897932384626433832795 * m / d)

The mathematical constant π (pi), scaled by m/d.
Template param T The numeric type.
Template param m Numerator multiplier (default is 1).
Template param d Denominator divisor (default is 1).
Note Examples: - c_pi<f64, 4> = 4π - c_pi<f64, 3, 4> = 3/4π


c_sqr_pi variable

template <typename T, int m = 1, int d = 1>
constexpr inline subtype<T> c_sqr_pi =
    subtype<T>(9.8696044010893586188344909998762 * m / d)

The square of π (pi²), scaled by m/d.
Template param T The numeric type.
Template param m Numerator multiplier (default is 1).
Template param d Denominator divisor (default is 1).
Note Examples: - c_sqr_pi<f64, 4> = 4π² - c_sqr_pi<f64, 3, 4> = 3/4π²


c_recip_pi variable

template <typename T, int m = 1, int d = 1>
constexpr inline subtype<T> c_recip_pi =
    subtype<T>(0.31830988618379067153776752674503 * m / d)

The reciprocal of π (1/π), scaled by m/d.
Template param T The numeric type.
Template param m Numerator multiplier (default is 1).
Template param d Denominator divisor (default is 1).
Note Examples: - c_recip_pi<f64> = 1/π - c_recip_pi<f64, 4> = 4/π


c_degtorad variable

template <typename T>
constexpr inline subtype<T> c_degtorad = c_pi<T, 1, 180>

Degrees to radians conversion factor (π / 180).
Template param T The numeric type.


c_radtodeg variable

template <typename T>
constexpr inline subtype<T> c_radtodeg = c_recip_pi<T, 180>

Radians to degrees conversion factor (180 / π).
Template param T The numeric type.


c_e variable

template <typename T, int m = 1, int d = 1>
constexpr inline subtype<T> c_e =
    subtype<T>(2.718281828459045235360287471352662 * m / d)

The mathematical constant e (Euler's number), scaled by m/d.
Template param T The numeric type.
Template param m Numerator multiplier (default is 1).
Template param d Denominator divisor (default is 1).


c_mantissa_bits variable

template <typename T>
constexpr inline unsigned c_mantissa_bits =
    sizeof(subtype<T>) == 32 ? 23 : 52

The number of mantissa bits for the given floating-point type.
Template param T The numeric type.


c_mantissa_mask variable

template <typename T>
constexpr inline subtype<T> c_mantissa_mask =
    (subtype<T>(1) << c_mantissa_bits<T>)-1

The bitmask for the mantissa of the floating-point representation.
Template param T The numeric type.


c_epsilon variable

template <typename T>
constexpr inline subtype<T> c_epsilon =
    (std::numeric_limits<subtype<T>>::epsilon())

The machine epsilon — the smallest value such that 1 + epsilon ≠ 1.
Template param T The numeric type.


c_infinity variable

template <typename T>
constexpr inline subtype<T> c_infinity =
    std::numeric_limits<subtype<T>>::infinity()

Positive infinity representation.
Template param T The numeric type.


c_neginfinity variable

template <typename T>
constexpr inline subtype<T> c_neginfinity =
    -std::numeric_limits<subtype<T>>::infinity()

Negative infinity representation.
Template param T The numeric type.


c_qnan variable

template <typename T>
constexpr inline subtype<T> c_qnan =
    std::numeric_limits<subtype<T>>::quiet_NaN()

A quiet NaN (Not-a-Number) value.
Template param T The numeric type.


c_recip_log_2 variable

template <typename T>
constexpr inline subtype<T> c_recip_log_2 = subtype<T>(
    1.442695040888963407359924681001892137426645954)

The reciprocal of the natural logarithm of 2 (1 / ln(2)).
Template param T The numeric type.


c_recip_log_10 variable

template <typename T>
constexpr inline subtype<T> c_recip_log_10 =
    subtype<T>(0.43429448190325182765112891891661)

The reciprocal of the natural logarithm of 10 (1 / ln(10)).
Template param T The numeric type.


c_log_2 variable

template <typename T>
constexpr inline subtype<T> c_log_2 =
    subtype<T>(0.69314718055994530941723212145818)

The natural logarithm of 2 (ln(2)).
Template param T The numeric type.


c_log_10 variable

template <typename T>
constexpr inline subtype<T> c_log_10 =
    subtype<T>(2.3025850929940456840179914546844)

The natural logarithm of 10 (ln(10)).
Template param T The numeric type.


c_sqrt_2 variable

template <typename T, int m = 1, int d = 1>
constexpr inline subtype<T> c_sqrt_2 =
    subtype<T>(1.4142135623730950488016887242097 * m / d)

The square root of 2 (√2), scaled by m/d.
Template param T The numeric type.
Template param m Numerator multiplier (default is 1).
Template param d Denominator divisor (default is 1).


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/