header_utils
Loading...
Searching...
No Matches
Constexpr Math

A re-implementation of some of the <cmath> functions but constexpr. More...

Functions

constexpr bool ghassanpl::constexpr_math::isnan (std::integral auto f) noexcept
constexpr bool ghassanpl::constexpr_math::isnan (float f)
constexpr bool ghassanpl::constexpr_math::isnan (double f)
constexpr bool ghassanpl::constexpr_math::isfinite (std::integral auto f) noexcept
constexpr bool ghassanpl::constexpr_math::isfinite (float f)
constexpr bool ghassanpl::constexpr_math::isfinite (double f)
template<std::floating_point T, typename RESULT = T>
constexpr RESULT ghassanpl::constexpr_math::floor (T num) noexcept
template<typename T>
constexpr bool ghassanpl::constexpr_math::signbit (T num)
template<typename T>
constexpr int ghassanpl::constexpr_math::sign (T val)
template<std::floating_point T, typename RESULT = T>
constexpr RESULT ghassanpl::constexpr_math::ceil (T num) noexcept
template<std::floating_point T, typename RESULT = T>
constexpr RESULT ghassanpl::constexpr_math::trunc (T num) noexcept
template<arithmetic T>
constexpr auto ghassanpl::constexpr_math::abs (T num)
template<arithmetic T, arithmetic U, arithmetic V>
constexpr auto ghassanpl::constexpr_math::fma (T a, U b, V c) noexcept
template<arithmetic T, arithmetic U>
constexpr auto ghassanpl::constexpr_math::fmod (T a, U b) noexcept
template<arithmetic T>
constexpr auto ghassanpl::constexpr_math::sqrt (T value) noexcept
template<arithmetic T, arithmetic U>
constexpr auto ghassanpl::constexpr_math::pow (T base, U exponent) noexcept
template<std::integral T>
constexpr unsigned ghassanpl::constexpr_math::ilog2 (T val) noexcept
constexpr double ghassanpl::constexpr_math::unlerp (const double a, const double b, const double t) noexcept

Detailed Description

A re-implementation of some of the <cmath> functions but constexpr.

Function Documentation

◆ abs()

template<arithmetic T>
auto ghassanpl::constexpr_math::abs ( T num)
nodiscardconstexpr

Definition at line 165 of file constexpr_math.h.

◆ ceil()

template<std::floating_point T, typename RESULT = T>
RESULT ghassanpl::constexpr_math::ceil ( T num)
nodiscardconstexprnoexcept

Definition at line 135 of file constexpr_math.h.

◆ floor()

template<std::floating_point T, typename RESULT = T>
RESULT ghassanpl::constexpr_math::floor ( T num)
nodiscardconstexprnoexcept

Definition at line 67 of file constexpr_math.h.

◆ fma()

template<arithmetic T, arithmetic U, arithmetic V>
auto ghassanpl::constexpr_math::fma ( T a,
U b,
V c )
nodiscardconstexprnoexcept

Definition at line 176 of file constexpr_math.h.

◆ fmod()

template<arithmetic T, arithmetic U>
auto ghassanpl::constexpr_math::fmod ( T a,
U b )
nodiscardconstexprnoexcept

Definition at line 192 of file constexpr_math.h.

◆ ilog2()

template<std::integral T>
unsigned ghassanpl::constexpr_math::ilog2 ( T val)
nodiscardconstexprnoexcept

Definition at line 258 of file constexpr_math.h.

◆ isfinite() [1/3]

bool ghassanpl::constexpr_math::isfinite ( double f)
nodiscardconstexpr

Definition at line 57 of file constexpr_math.h.

◆ isfinite() [2/3]

bool ghassanpl::constexpr_math::isfinite ( float f)
nodiscardconstexpr

Definition at line 51 of file constexpr_math.h.

◆ isfinite() [3/3]

bool ghassanpl::constexpr_math::isfinite ( std::integral auto f)
nodiscardconstexprnoexcept

Definition at line 50 of file constexpr_math.h.

◆ isnan() [1/3]

bool ghassanpl::constexpr_math::isnan ( double f)
nodiscardconstexpr

Definition at line 44 of file constexpr_math.h.

◆ isnan() [2/3]

bool ghassanpl::constexpr_math::isnan ( float f)
nodiscardconstexpr

Definition at line 38 of file constexpr_math.h.

◆ isnan() [3/3]

bool ghassanpl::constexpr_math::isnan ( std::integral auto f)
nodiscardconstexprnoexcept

Definition at line 37 of file constexpr_math.h.

◆ pow()

template<arithmetic T, arithmetic U>
auto ghassanpl::constexpr_math::pow ( T base,
U exponent )
nodiscardconstexprnoexcept

Definition at line 235 of file constexpr_math.h.

◆ sign()

template<typename T>
int ghassanpl::constexpr_math::sign ( T val)
nodiscardconstexpr

Definition at line 122 of file constexpr_math.h.

◆ signbit()

template<typename T>
bool ghassanpl::constexpr_math::signbit ( T num)
nodiscardconstexprnoexcept

Definition at line 87 of file constexpr_math.h.

◆ sqrt()

template<arithmetic T>
auto ghassanpl::constexpr_math::sqrt ( T value)
nodiscardconstexprnoexcept

Definition at line 222 of file constexpr_math.h.

◆ trunc()

template<std::floating_point T, typename RESULT = T>
RESULT ghassanpl::constexpr_math::trunc ( T num)
nodiscardconstexprnoexcept

Definition at line 154 of file constexpr_math.h.

◆ unlerp()

double ghassanpl::constexpr_math::unlerp ( const double a,
const double b,
const double t )
inlinenodiscardconstexprnoexcept

Definition at line 270 of file constexpr_math.h.