header_utils
Loading...
Searching...
No Matches
ghassanpl::constexpr_math Namespace Reference

Functions

constexpr bool isnan (std::integral auto f) noexcept
 
constexpr bool isnan (float f)
 
constexpr bool isnan (double f)
 
constexpr bool isfinite (float f)
 
constexpr bool isfinite (double f)
 
template<std::floating_point T, typename RESULT = T>
constexpr RESULT floor (T num) noexcept
 Shamelessly stolen from https://gist.github.com/Redchards/7f1b357bf3e686b55362.
 
template<typename T >
requires std::is_signed_v<T>
constexpr bool signbit (T num)
 can throw
 
template<typename T >
requires (!std::is_signed_v<T>)
constexpr bool signbit (T val) noexcept
 
template<typename T >
constexpr int sign (T val)
 
template<std::floating_point T, typename RESULT = T>
constexpr RESULT ceil (T num) noexcept
 TODO: sign return num > 0 ? 1 : (num < 0 ? -1 : 0);.
 
template<std::floating_point T, typename RESULT = T>
constexpr RESULT trunc (T num) noexcept
 
template<arithmetic T>
constexpr auto abs (T num)
 TODO: round.
 
template<arithmetic T, arithmetic U, arithmetic V>
constexpr auto fma (T a, U b, V c) noexcept
 
template<arithmetic T, arithmetic U>
constexpr auto fmod (T a, U b) noexcept
 
template<arithmetic T>
constexpr auto sqrt (T value) noexcept
 
template<arithmetic T, arithmetic U>
constexpr auto pow (T base, U exponent) noexcept
 
template<std::integral T>
constexpr unsigned ilog2 (T val) noexcept
 

Detailed Description

Function Documentation

◆ abs()

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

TODO: round.

can throw

Definition at line 161 of file constexpr_math.h.

◆ ceil()

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

TODO: sign return num > 0 ? 1 : (num < 0 ? -1 : 0);.

Definition at line 131 of file constexpr_math.h.

◆ floor()

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

Shamelessly stolen from https://gist.github.com/Redchards/7f1b357bf3e686b55362.

Definition at line 63 of file constexpr_math.h.

◆ fma()

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

Definition at line 172 of file constexpr_math.h.

◆ fmod()

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

Definition at line 188 of file constexpr_math.h.

◆ ilog2()

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

Definition at line 254 of file constexpr_math.h.

◆ isfinite() [1/2]

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

Definition at line 53 of file constexpr_math.h.

◆ isfinite() [2/2]

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

Definition at line 47 of file constexpr_math.h.

◆ isnan() [1/3]

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

Definition at line 41 of file constexpr_math.h.

◆ isnan() [2/3]

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

Definition at line 35 of file constexpr_math.h.

◆ isnan() [3/3]

constexpr bool ghassanpl::constexpr_math::isnan ( std::integral auto  f)
constexprnoexcept

Definition at line 34 of file constexpr_math.h.

◆ pow()

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

Definition at line 231 of file constexpr_math.h.

◆ sign()

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

Definition at line 118 of file constexpr_math.h.

◆ signbit() [1/2]

template<typename T >
requires std::is_signed_v<T>
constexpr bool ghassanpl::constexpr_math::signbit ( num)
constexpr

can throw

Definition at line 83 of file constexpr_math.h.

◆ signbit() [2/2]

template<typename T >
requires (!std::is_signed_v<T>)
constexpr bool ghassanpl::constexpr_math::signbit ( val)
constexprnoexcept

Definition at line 112 of file constexpr_math.h.

◆ sqrt()

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

Definition at line 218 of file constexpr_math.h.

◆ trunc()

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

Definition at line 150 of file constexpr_math.h.