sandbox
Loading...
Searching...
No Matches
constants.hpp File Reference

Mathematical constants. More...

#include <cstdint>
#include <cmath>
#include <limits>
#include <numbers>
#include <libsbx/math/concepts.hpp>

Go to the source code of this file.

Namespaces

namespace  libsbx
 

Variables

template<floating_point Type>
constexpr auto sbx::math::epsilon_v = std::numeric_limits<Type>::epsilon()
 Machine epsilon for a floating-point type. More...
 
constexpr auto sbx::math::epsilonf = epsilon_v<std::float_t>
 Machine epsilon for std::float_t.
 
constexpr auto sbx::math::epsilond = epsilon_v<std::double_t>
 Machine epsilon for std::double_t.
 
constexpr auto sbx::math::epsilon = epsilonf
 Default machine epsilon. More...
 
template<floating_point Type>
constexpr auto sbx::math::pi_v = std::numbers::pi_v<Type>
 Pi constant for a floating-point type. More...
 
constexpr auto sbx::math::pif = pi_v<std::float_t>
 Pi constant for std::float_t.
 
constexpr auto sbx::math::pid = pi_v<std::double_t>
 Pi constant for std::double_t.
 
constexpr auto sbx::math::pi = pif
 Default pi constant. More...
 
template<floating_point Type>
constexpr auto sbx::math::two_pi_v = static_cast<Type>(2) * pi_v<Type>
 Two-pi constant for a floating-point type. More...
 
constexpr auto sbx::math::two_pif = two_pi_v<std::float_t>
 Two-pi constant for std::float_t.
 
constexpr auto sbx::math::two_pid = two_pi_v<std::double_t>
 Two-pi constant for std::double_t.
 
constexpr auto sbx::math::two_pi = two_pif
 Default two-pi constant. More...
 

Detailed Description

Mathematical constants.

This header defines commonly used mathematical constants in a type-safe, constexpr-friendly manner. Constants are provided as variable templates parameterized on floating-point type, along with convenient aliases for commonly used precisions.

All constants are intended to be used consistently across the math module to avoid magic numbers and precision mismatches.

Author
KAJ

Variable Documentation

◆ epsilon

constexpr auto sbx::math::epsilon = epsilonf
inlineconstexpr

Default machine epsilon.

Alias for epsilonf.

◆ epsilon_v

template<floating_point Type>
constexpr auto sbx::math::epsilon_v = std::numeric_limits<Type>::epsilon()
inlineconstexpr

Machine epsilon for a floating-point type.

Template Parameters
TypeFloating-point type.

◆ pi

constexpr auto sbx::math::pi = pif
inlineconstexpr

Default pi constant.

Alias for pif.

◆ pi_v

template<floating_point Type>
constexpr auto sbx::math::pi_v = std::numbers::pi_v<Type>
inlineconstexpr

Pi constant for a floating-point type.

Template Parameters
TypeFloating-point type.

◆ two_pi

constexpr auto sbx::math::two_pi = two_pif
inlineconstexpr

Default two-pi constant.

Alias for two_pif.

◆ two_pi_v

template<floating_point Type>
constexpr auto sbx::math::two_pi_v = static_cast<Type>(2) * pi_v<Type>
inlineconstexpr

Two-pi constant for a floating-point type.

Template Parameters
TypeFloating-point type.