ToyGine2 26.2.0
Game Engine for retro consoles
Loading...
Searching...
No Matches
toy::math::constants Namespace Reference

Variable templates for mathematical constants. More...

Variables

template<FractionalConstantType T>
constexpr T e_v = std::numbers::e_v<T>
 Mathematical constant e.
template<FractionalConstantType T>
constexpr T pi_v = std::numbers::pi_v<T>
 Mathematical constant π.
template<FractionalConstantType T>
constexpr T log2e_v = std::numbers::log2e_v<T>
 Base-2 logarithm of e.
template<FractionalConstantType T>
constexpr T log10e_v = std::numbers::log10e_v<T>
 Base-10 logarithm of e.
template<FractionalConstantType T>
constexpr T sqrt2_v = std::numbers::sqrt2_v<T>
 Square root of 2.
template<FractionalConstantType T>
constexpr T sqrt3_v = std::numbers::sqrt3_v<T>
 Square root of 3.
template<FractionalConstantType T>
constexpr T inv_pi_v = std::numbers::inv_pi_v<T>
 1 over π.
template<FractionalConstantType T>
constexpr T inv_sqrtpi_v = std::numbers::inv_sqrtpi_v<T>
 1 over square root of π.
template<FractionalConstantType T>
constexpr T ln2_v = std::numbers::ln2_v<T>
 Natural logarithm of 2.
template<FractionalConstantType T>
constexpr T ln10_v = std::numbers::ln10_v<T>
 Natural logarithm of 10.
template<FractionalConstantType T>
constexpr T egamma_v = std::numbers::egamma_v<T>
 Euler–Mascheroni constant γ.
template<FractionalConstantType T>
constexpr T phi_v = std::numbers::phi_v<T>
 Golden ratio Φ.
template<FractionalConstantType T>
constexpr T rad_per_deg_v = static_cast<T>(std::numbers::pi_v<long double> / 180.0L)
 π over 180 (radians per degree).
template<FractionalConstantType T>
constexpr T deg_per_rad_v = static_cast<T>(180.0L / std::numbers::pi_v<long double>)
 180 over π (degrees per radian).

Detailed Description

Variable templates for mathematical constants.

Single API for toy::math::FractionalConstantType: float, double, long double, and toy::math::fixed. Values forward to std::numbers for built-in floating-point types and to std::numbers specializations for toy::math::fixed (see math/fixed_std_extension.hpp).

Variable Documentation

◆ deg_per_rad_v

template<FractionalConstantType T>
T toy::math::constants::deg_per_rad_v = static_cast<T>(180.0L / std::numbers::pi_v<long double>)
constexpr

180 over π (degrees per radian).

◆ e_v

template<FractionalConstantType T>
T toy::math::constants::e_v = std::numbers::e_v<T>
constexpr

Mathematical constant e.

◆ egamma_v

template<FractionalConstantType T>
T toy::math::constants::egamma_v = std::numbers::egamma_v<T>
constexpr

Euler–Mascheroni constant γ.

◆ inv_pi_v

template<FractionalConstantType T>
T toy::math::constants::inv_pi_v = std::numbers::inv_pi_v<T>
constexpr

1 over π.

◆ inv_sqrtpi_v

template<FractionalConstantType T>
T toy::math::constants::inv_sqrtpi_v = std::numbers::inv_sqrtpi_v<T>
constexpr

1 over square root of π.

◆ ln10_v

template<FractionalConstantType T>
T toy::math::constants::ln10_v = std::numbers::ln10_v<T>
constexpr

Natural logarithm of 10.

◆ ln2_v

template<FractionalConstantType T>
T toy::math::constants::ln2_v = std::numbers::ln2_v<T>
constexpr

Natural logarithm of 2.

◆ log10e_v

template<FractionalConstantType T>
T toy::math::constants::log10e_v = std::numbers::log10e_v<T>
constexpr

Base-10 logarithm of e.

◆ log2e_v

template<FractionalConstantType T>
T toy::math::constants::log2e_v = std::numbers::log2e_v<T>
constexpr

Base-2 logarithm of e.

◆ phi_v

template<FractionalConstantType T>
T toy::math::constants::phi_v = std::numbers::phi_v<T>
constexpr

Golden ratio Φ.

◆ pi_v

template<FractionalConstantType T>
T toy::math::constants::pi_v = std::numbers::pi_v<T>
constexpr

Mathematical constant π.

◆ rad_per_deg_v

template<FractionalConstantType T>
T toy::math::constants::rad_per_deg_v = static_cast<T>(std::numbers::pi_v<long double> / 180.0L)
constexpr

π over 180 (radians per degree).

◆ sqrt2_v

template<FractionalConstantType T>
T toy::math::constants::sqrt2_v = std::numbers::sqrt2_v<T>
constexpr

Square root of 2.

◆ sqrt3_v

template<FractionalConstantType T>
T toy::math::constants::sqrt3_v = std::numbers::sqrt3_v<T>
constexpr

Square root of 3.