Base Framework
Static Public Member Functions | Static Public Attributes | List of all members
Math Class Reference

Mathematical functions. More...

#include <base/math/Math.h>

Static Public Member Functions

static bool isFinite (float value) noexcept
 
static bool isFinite (double value) noexcept
 
static bool isFinite (long double value) noexcept
 
static bool isInfinity (float value) noexcept
 
static bool isInfinity (double value) noexcept
 
static bool isInfinity (long double value) noexcept
 
static bool isNaN (float value) noexcept
 
static bool isNaN (double value) noexcept
 
static bool isNaN (long double value) noexcept
 
template<typename TYPE >
static constexpr TYPE getZero (bool negative) noexcept
 
template<typename TYPE >
static constexpr TYPE getInfinity () noexcept
 
template<typename TYPE >
static constexpr TYPE getNaN () noexcept
 
static float abs (float value) noexcept
 
static double abs (double value) noexcept
 
static long double abs (long double value) noexcept
 
static float ceil (float value) noexcept
 
static double ceil (double value) noexcept
 
static long double ceil (long double value) noexcept
 
static float floor (float value) noexcept
 
static double floor (double value) noexcept
 
static long double floor (long double value) noexcept
 
static float round (float value) noexcept
 
static double round (double value) noexcept
 
static long double round (long double value) noexcept
 
static float trunc (float value) noexcept
 
static double trunc (double value) noexcept
 
static long double trunc (long double value) noexcept
 
static float frac (float value) noexcept
 
static double frac (double value) noexcept
 
static long double frac (long double value) noexcept
 
static float sqrt (float value) noexcept
 
static double sqrt (double value) noexcept
 
static long double sqrt (long double value) noexcept
 
static float cbrt (float value) noexcept
 
static double cbrt (double value) noexcept
 
static long double cbrt (long double value) noexcept
 
static float hypot (float x, float y) noexcept
 
static double hypot (double x, double y) noexcept
 
static long double hypot (long double x, long double y) noexcept
 
static float exp (float value) noexcept
 
static double exp (double value) noexcept
 
static long double exp (long double value) noexcept
 
static float ln (float value) noexcept
 
static double ln (double value) noexcept
 
static long double ln (long double value) noexcept
 
static float log2 (float value) noexcept
 
static double log2 (double value) noexcept
 
static long double log2 (long double value) noexcept
 
static float log10 (float value) noexcept
 
static double log10 (double value) noexcept
 
static long double log10 (long double value) noexcept
 
static float logn (float value, float base) noexcept
 
static double logn (double value, double base) noexcept
 
static long double logn (long double value, long double base) noexcept
 
static float power (float a, float b) noexcept
 
static double power (double a, double b) noexcept
 
static long double power (long double a, long double b) noexcept
 
static float sin (float value) noexcept
 
static double sin (double value) noexcept
 
static long double sin (long double value) noexcept
 
static float asin (float value) noexcept
 
static double asin (double value) noexcept
 
static long double asin (long double value) noexcept
 
static float cos (float value) noexcept
 
static double cos (double value) noexcept
 
static long double cos (long double value) noexcept
 
static float acos (float value) noexcept
 
static double acos (double value) noexcept
 
static long double acos (long double value) noexcept
 
static float tan (float value) noexcept
 
static double tan (double value) noexcept
 
static long double tan (long double value)
 
static float atan (float value) noexcept
 
static double atan (double value) noexcept
 
static long double atan (long double value) noexcept
 
static long double cotan (long double value) noexcept
 
static long double acotan (long double value) noexcept
 
static long double sec (long double value) noexcept
 
static long double asec (long double value) noexcept
 
static long double cosec (long double value) noexcept
 
static long double acosec (long double value) noexcept
 
static long double exsec (long double value) noexcept
 
static long double aexsec (long double value) noexcept
 
static long double vers (long double value) noexcept
 
static long double avers (long double value) noexcept
 
static long double hav (long double value) noexcept
 
static long double ahav (long double value) noexcept
 
static long double covers (long double value) noexcept
 
static long double acovers (long double value) noexcept
 
static float atan2 (float y, float x) noexcept
 
static double atan2 (double y, double x) noexcept
 
static long double atan2 (long double y, long double x) noexcept
 
static float sinh (float value) noexcept
 
static double sinh (double value) noexcept
 
static long double sinh (long double value) noexcept
 
static float asinh (float value) noexcept
 
static double asinh (double value) noexcept
 
static long double asinh (long double value) noexcept
 
static float cosh (float value) noexcept
 
static double cosh (double value) noexcept
 
static long double cosh (long double value) noexcept
 
static float acosh (float value) noexcept
 
static double acosh (double value) noexcept
 
static long double acosh (long double value) noexcept
 
static float tanh (float value) noexcept
 
static double tanh (double value) noexcept
 
static long double tanh (long double value) noexcept
 
static float atanh (float value) noexcept
 
static double atanh (double value) noexcept
 
static long double atanh (long double value) noexcept
 
static float cotanh (float value) noexcept
 
static double cotanh (double value) noexcept
 
static long double cotanh (long double value) noexcept
 
static float acotanh (float value) noexcept
 
static double acotanh (double value) noexcept
 
static long double acotanh (long double value) noexcept
 
static float sech (float value) noexcept
 
static double sech (double value) noexcept
 
static long double sech (long double value) noexcept
 
static float asech (float value) noexcept
 
static double asech (double value) noexcept
 
static long double asech (long double value) noexcept
 
static float cosech (float value) noexcept
 
static double cosech (double value) noexcept
 
static long double cosech (long double value) noexcept
 
static float acosech (float value) noexcept
 
static double acosech (double value) noexcept
 
static long double acosech (long double value) noexcept
 
static float sinc (float value) noexcept
 
static double sinc (double value) noexcept
 
static long double sinc (long double value) noexcept
 
static float sincPi (float value) noexcept
 
static double sincPi (double value) noexcept
 
static long double sincPi (long double value) noexcept
 
static float tanc (float value) noexcept
 
static double tanc (double value) noexcept
 
static long double tanc (long double value) noexcept
 
static double lngamma (double value) noexcept
 
static unsigned int iSqrt (unsigned int value) noexcept
 
static unsigned int iSqrt8 (unsigned int value) noexcept
 
static unsigned int iSqrt16 (unsigned int value) noexcept
 
static unsigned int iSqrt8Round (unsigned int value) noexcept
 
static bool isPowerOf2 (uint8 value) noexcept
 
static bool isPowerOf2 (uint32 value) noexcept
 
static bool isPowerOf2 (unsigned long long value) noexcept
 
static unsigned int iLog2 (unsigned int value) noexcept
 
static unsigned int iLog2 (unsigned long value) noexcept
 
static unsigned int iLog2 (unsigned long long value) noexcept
 
static unsigned int getPowerOf2 (unsigned int value) noexcept
 
static unsigned long getPowerOf2 (unsigned long value) noexcept
 
static unsigned long long getPowerOf2 (unsigned long long value) noexcept
 
static unsigned int getHighestBit (uint8 value) noexcept
 
static unsigned int getHighestBit (uint16 value) noexcept
 
static unsigned int getHighestBit (uint32 value) noexcept
 
static unsigned int getHighestBit (uint64 value) noexcept
 
static unsigned int getHighestBit (const uint128 &value) noexcept
 
static uint8 getBitReversal (uint8 value) noexcept
 
static uint16 getBitReversal (uint16 value) noexcept
 
static uint32 getBitReversal (uint32 value) noexcept
 
static uint64 getBitReversal (uint64 value) noexcept
 
static unsigned int ror (unsigned int value, unsigned int count=1) noexcept
 
static unsigned int rol (unsigned int value, unsigned int count=1) noexcept
 
static int gcd (int m, int n) noexcept
 
static unsigned int gcd (unsigned int n, unsigned int m) noexcept
 
static int lcm (int m, int n) noexcept
 
static unsigned int lcm (unsigned int n, unsigned int m) noexcept
 
static uint64 muldiv (uint64 value, uint64 mul, uint64 div)
 
static uint8 addCarry (uint8 &value, const uint8 addend) noexcept
 
static uint16 addCarry (uint16 &value, const uint16 addend) noexcept
 
static uint32 addCarry (uint32 &value, const uint32 addend) noexcept
 
static uint64 addCarry (uint64 &value, const uint64 addend) noexcept
 
static uint8 subtractBorrow (uint8 &value, const uint8 subtrahend) noexcept
 
static uint16 subtractBorrow (uint16 &value, const uint16 subtrahend) noexcept
 
static uint32 subtractBorrow (uint32 &value, const uint32 subtrahend) noexcept
 
static uint64 subtractBorrow (uint64 &value, const uint64 subtrahend) noexcept
 
template<>
constexpr float getZero (bool negative) noexcept
 
template<>
constexpr double getZero (bool negative) noexcept
 
template<>
constexpr long double getZero (bool negative) noexcept
 
template<>
float getInfinity () noexcept
 
template<>
double getInfinity () noexcept
 
template<>
long double getInfinity () noexcept
 
template<>
float getNaN () noexcept
 
template<>
double getNaN () noexcept
 
template<>
long double getNaN () noexcept
 

Static Public Attributes

static const int64 EXPONENTS10_64 [19]
 
static const int64 EXPONENTS5_64 [28]
 
static const int64 EXPONENTS2_64 [63]
 
static const int32 EXPONENTS10_32 [10]
 
static const int32 EXPONENTS5_32 [14]
 
static const int32 EXPONENTS2_32 [31]
 

Detailed Description

Mathematical functions.

This class is a placeholder for mathematical functions.

Version
1.0

Member Function Documentation

◆ abs() [1/3]

static double Math::abs ( double  value)
inlinestaticnoexcept

Returns the absolute value.

◆ abs() [2/3]

static float Math::abs ( float  value)
inlinestaticnoexcept

Returns the absolute value.

Examples
testsuite/eval.cpp.

◆ abs() [3/3]

static long double Math::abs ( long double  value)
inlinestaticnoexcept

Returns the absolute value.

◆ acos() [1/3]

static double Math::acos ( double  value)
inlinestaticnoexcept

Returns the inverse cosine.

◆ acos() [2/3]

static float Math::acos ( float  value)
inlinestaticnoexcept

Returns the inverse cosine.

Examples
testsuite/eval.cpp.

◆ acos() [3/3]

static long double Math::acos ( long double  value)
inlinestaticnoexcept

Returns the inverse cosine.

◆ acosec()

static long double Math::acosec ( long double  value)
inlinestaticnoexcept

Returns the inverse cosecant of the value.

Examples
testsuite/eval.cpp.

◆ acosech() [1/3]

static double Math::acosech ( double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cosecant of the value (do not invoke for 0).

◆ acosech() [2/3]

static float Math::acosech ( float  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cosecant of the value (do not invoke for 0).

Examples
testsuite/eval.cpp.

◆ acosech() [3/3]

static long double Math::acosech ( long double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cosecant of the value (do not invoke for 0).

◆ acosh() [1/3]

static double Math::acosh ( double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cosine.

◆ acosh() [2/3]

static float Math::acosh ( float  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cosine.

Examples
testsuite/eval.cpp.

◆ acosh() [3/3]

static long double Math::acosh ( long double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cosine.

◆ acotan()

static long double Math::acotan ( long double  value)
inlinestaticnoexcept

Returns the inverse cotangent of the value.

Examples
testsuite/eval.cpp.

◆ acotanh() [1/3]

static double Math::acotanh ( double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cotangent of the value.

◆ acotanh() [2/3]

static float Math::acotanh ( float  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cotangent of the value.

Examples
testsuite/eval.cpp.

◆ acotanh() [3/3]

static long double Math::acotanh ( long double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic cotangent of the value.

◆ acovers()

static long double Math::acovers ( long double  value)
inlinestaticnoexcept

Returns the inverse coversine of the value.

Examples
testsuite/eval.cpp.

◆ addCarry() [1/4]

static uint16 Math::addCarry ( uint16 &  value,
const uint16  addend 
)
inlinestaticnoexcept

Returns the carry for the addition.

◆ addCarry() [2/4]

static uint32 Math::addCarry ( uint32 &  value,
const uint32  addend 
)
inlinestaticnoexcept

Returns the carry for the addition.

◆ addCarry() [3/4]

static uint64 Math::addCarry ( uint64 &  value,
const uint64  addend 
)
inlinestaticnoexcept

Returns the carry for the addition.

◆ addCarry() [4/4]

static uint8 Math::addCarry ( uint8 &  value,
const uint8  addend 
)
inlinestaticnoexcept

Returns the carry for the addition.

◆ aexsec()

static long double Math::aexsec ( long double  value)
inlinestaticnoexcept

Returns the inverse exsecant of the value.

Examples
testsuite/eval.cpp.

◆ ahav()

static long double Math::ahav ( long double  value)
inlinestaticnoexcept

Returns the inverse hav of the value.

Examples
testsuite/eval.cpp.

◆ asec()

static long double Math::asec ( long double  value)
inlinestaticnoexcept

Returns the inverse secant of the value.

Examples
testsuite/eval.cpp.

◆ asech() [1/3]

static double Math::asech ( double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic secant of the value.

◆ asech() [2/3]

static float Math::asech ( float  value)
inlinestaticnoexcept

Returns the inverse hyperbolic secant of the value.

Examples
testsuite/eval.cpp.

◆ asech() [3/3]

static long double Math::asech ( long double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic secant of the value.

◆ asin() [1/3]

static double Math::asin ( double  value)
inlinestaticnoexcept

Returns the inverse sine.

◆ asin() [2/3]

static float Math::asin ( float  value)
inlinestaticnoexcept

Returns the inverse sine.

Examples
testsuite/eval.cpp.

◆ asin() [3/3]

static long double Math::asin ( long double  value)
inlinestaticnoexcept

Returns the inverse sine.

◆ asinh() [1/3]

static double Math::asinh ( double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic sine.

◆ asinh() [2/3]

static float Math::asinh ( float  value)
inlinestaticnoexcept

Returns the inverse hyperbolic sine.

Examples
testsuite/eval.cpp.

◆ asinh() [3/3]

static long double Math::asinh ( long double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic sine.

◆ atan() [1/3]

static double Math::atan ( double  value)
inlinestaticnoexcept

Returns the inverse tangent.

◆ atan() [2/3]

static float Math::atan ( float  value)
inlinestaticnoexcept

Returns the inverse tangent.

Examples
testsuite/eval.cpp.

◆ atan() [3/3]

static long double Math::atan ( long double  value)
inlinestaticnoexcept

Returns the inverse tangent.

◆ atan2() [1/3]

static double Math::atan2 ( double  y,
double  x 
)
inlinestaticnoexcept

Returns the arc tangent of y/x using the signs of both arguments to determine the proper quadrant.

◆ atan2() [2/3]

static float Math::atan2 ( float  y,
float  x 
)
inlinestaticnoexcept

Returns the arc tangent of y/x using the signs of both arguments to determine the proper quadrant.

Examples
testsuite/eval.cpp.

◆ atan2() [3/3]

static long double Math::atan2 ( long double  y,
long double  x 
)
inlinestaticnoexcept

Returns the arc tangent of y/x using the signs of both arguments to determine the proper quadrant.

◆ atanh() [1/3]

static double Math::atanh ( double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic tangent.

◆ atanh() [2/3]

static float Math::atanh ( float  value)
inlinestaticnoexcept

Returns the inverse hyperbolic tangent.

Examples
testsuite/eval.cpp.

◆ atanh() [3/3]

static long double Math::atanh ( long double  value)
inlinestaticnoexcept

Returns the inverse hyperbolic tangent.

◆ avers()

static long double Math::avers ( long double  value)
inlinestaticnoexcept

Returns the inverse versine of the value.

Examples
testsuite/eval.cpp.

◆ cbrt() [1/3]

static double Math::cbrt ( double  value)
inlinestaticnoexcept

Returns the cube root of the value.

◆ cbrt() [2/3]

static float Math::cbrt ( float  value)
inlinestaticnoexcept

Returns the cube root of the value.

◆ cbrt() [3/3]

static long double Math::cbrt ( long double  value)
inlinestaticnoexcept

Returns the cube root of the value.

◆ ceil() [1/3]

static double Math::ceil ( double  value)
inlinestaticnoexcept

Rounds (towards +infinity) the value to the nearest integer.

◆ ceil() [2/3]

static float Math::ceil ( float  value)
inlinestaticnoexcept

Rounds (towards +infinity) the value to the nearest integer.

Examples
testsuite/eval.cpp.

◆ ceil() [3/3]

static long double Math::ceil ( long double  value)
inlinestaticnoexcept

Rounds (towards +infinity) the value to the nearest integer.

◆ cos() [1/3]

static double Math::cos ( double  value)
inlinestaticnoexcept

Returns the cosine.

◆ cos() [2/3]

static float Math::cos ( float  value)
inlinestaticnoexcept

Returns the cosine.

Examples
testsuite/eval.cpp.

◆ cos() [3/3]

static long double Math::cos ( long double  value)
inlinestaticnoexcept

Returns the cosine.

◆ cosec()

static long double Math::cosec ( long double  value)
inlinestaticnoexcept

Returns the cosecant of the value.

Examples
testsuite/eval.cpp.

◆ cosech() [1/3]

static double Math::cosech ( double  value)
inlinestaticnoexcept

Returns the hyperbolic cosecant of the value (do not invoke for 0).

◆ cosech() [2/3]

static float Math::cosech ( float  value)
inlinestaticnoexcept

Returns the hyperbolic cosecant of the value (do not invoke for 0).

Examples
testsuite/eval.cpp.

◆ cosech() [3/3]

static long double Math::cosech ( long double  value)
inlinestaticnoexcept

Returns the hyperbolic cosecant of the value (do not invoke for 0).

◆ cosh() [1/3]

static double Math::cosh ( double  value)
inlinestaticnoexcept

Returns the hyperbolic cosine.

◆ cosh() [2/3]

static float Math::cosh ( float  value)
inlinestaticnoexcept

Returns the hyperbolic cosine.

Examples
testsuite/eval.cpp.

◆ cosh() [3/3]

static long double Math::cosh ( long double  value)
inlinestaticnoexcept

Returns the hyperbolic cosine.

◆ cotan()

static long double Math::cotan ( long double  value)
inlinestaticnoexcept

Returns the cotangent of the value.

Examples
testsuite/eval.cpp.

◆ cotanh() [1/3]

static double Math::cotanh ( double  value)
inlinestaticnoexcept

Returns the hyperbolic cotangent of the value (do not invoke for 0).

◆ cotanh() [2/3]

static float Math::cotanh ( float  value)
inlinestaticnoexcept

Returns the hyperbolic cotangent of the value (do not invoke for 0).

Examples
testsuite/eval.cpp.

◆ cotanh() [3/3]

static long double Math::cotanh ( long double  value)
inlinestaticnoexcept

Returns the hyperbolic cotangent of the value (do not invoke for 0).

◆ covers()

static long double Math::covers ( long double  value)
inlinestaticnoexcept

Returns the coversine of value.

Examples
testsuite/eval.cpp.

◆ exp() [1/3]

static double Math::exp ( double  value)
inlinestaticnoexcept

Returns the exponential of the value.

◆ exp() [2/3]

static float Math::exp ( float  value)
inlinestaticnoexcept

Returns the exponential of the value.

Examples
testsuite/eval.cpp.

◆ exp() [3/3]

static long double Math::exp ( long double  value)
inlinestaticnoexcept

Returns the exponential of the value.

◆ exsec()

static long double Math::exsec ( long double  value)
inlinestaticnoexcept

Returns the exsecant of the value.

Examples
testsuite/eval.cpp.

◆ floor() [1/3]

static double Math::floor ( double  value)
inlinestaticnoexcept

Rounds (towards -infinity) the value to the nearest integer.

◆ floor() [2/3]

static float Math::floor ( float  value)
inlinestaticnoexcept

Rounds (towards -infinity) the value to the nearest integer.

Examples
testsuite/eval.cpp.

◆ floor() [3/3]

static long double Math::floor ( long double  value)
inlinestaticnoexcept

Rounds (towards -infinity) the value to the nearest integer.

◆ frac() [1/3]

static double Math::frac ( double  value)
staticnoexcept

Returns the fraction.

◆ frac() [2/3]

static float Math::frac ( float  value)
staticnoexcept

Returns the fraction.

◆ frac() [3/3]

static long double Math::frac ( long double  value)
staticnoexcept

Returns the fraction.

◆ gcd() [1/2]

static int Math::gcd ( int  m,
int  n 
)
staticnoexcept

Returns the greatest common divisor.

◆ gcd() [2/2]

static unsigned int Math::gcd ( unsigned int  n,
unsigned int  m 
)
staticnoexcept

Returns the greatest common divisor.

◆ getBitReversal() [1/4]

static uint16 Math::getBitReversal ( uint16  value)
inlinestaticnoexcept

Returns the bit reversal of the specified 16 bit unsigned integer.

◆ getBitReversal() [2/4]

static uint32 Math::getBitReversal ( uint32  value)
inlinestaticnoexcept

Returns the bit reversal of the specified 32 bit unsigned integer.

◆ getBitReversal() [3/4]

static uint64 Math::getBitReversal ( uint64  value)
inlinestaticnoexcept

Returns the bit reversal of the specified 64 bit unsigned integer.

◆ getBitReversal() [4/4]

static uint8 Math::getBitReversal ( uint8  value)
inlinestaticnoexcept

Returns the bit reversal of the specified 8 bit unsigned integer.

◆ getHighestBit() [1/5]

static unsigned int Math::getHighestBit ( const uint128 value)
inlinestaticnoexcept

Returns the bit index of the highest set bit.

◆ getHighestBit() [2/5]

static unsigned int Math::getHighestBit ( uint16  value)
inlinestaticnoexcept

Returns the bit index of the highest set bit.

◆ getHighestBit() [3/5]

static unsigned int Math::getHighestBit ( uint32  value)
inlinestaticnoexcept

Returns the bit index of the highest set bit.

◆ getHighestBit() [4/5]

static unsigned int Math::getHighestBit ( uint64  value)
inlinestaticnoexcept

Returns the bit index of the highest set bit.

◆ getHighestBit() [5/5]

static unsigned int Math::getHighestBit ( uint8  value)
inlinestaticnoexcept

Returns the bit index of the highest set bit.

◆ getInfinity() [1/4]

template<typename TYPE >
static constexpr TYPE Math::getInfinity ( )
staticconstexprnoexcept

Returns infinity. You get negative infinity by using - operator.

◆ getInfinity() [2/4]

template<>
float Math::getInfinity ( )
inlinestaticnoexcept

Returns +infinity for float.

◆ getInfinity() [3/4]

template<>
double Math::getInfinity ( )
inlinestaticnoexcept

Returns +infinity for double.

◆ getInfinity() [4/4]

template<>
long double Math::getInfinity ( )
inlinestaticnoexcept

Returns +infinity for long double.

◆ getNaN() [1/4]

template<typename TYPE >
static constexpr TYPE Math::getNaN ( )
staticconstexprnoexcept

Returns quiet NaN. Signaling NaN should be avoided due to platform inconsistencies.

◆ getNaN() [2/4]

template<>
float Math::getNaN ( )
inlinestaticnoexcept

Returns quiet NaN for float.

◆ getNaN() [3/4]

template<>
double Math::getNaN ( )
inlinestaticnoexcept

Returns quiet NaN for double.

◆ getNaN() [4/4]

template<>
long double Math::getNaN ( )
inlinestaticnoexcept

Returns quiet NaN for long double.

◆ getPowerOf2() [1/3]

static unsigned int Math::getPowerOf2 ( unsigned int  value)
inlinestaticnoexcept

Returns the power of 2 greater than or equal to the specified value.

Returns
0 if power of 2 exceeds limit.

◆ getPowerOf2() [2/3]

static unsigned long long Math::getPowerOf2 ( unsigned long long  value)
inlinestaticnoexcept

Returns the power of 2 greater than or equal to the specified value.

Returns
0 if power of 2 exceeds limit.

◆ getPowerOf2() [3/3]

static unsigned long Math::getPowerOf2 ( unsigned long  value)
inlinestaticnoexcept

Returns the power of 2 greater than or equal to the specified value.

Returns
0 if power of 2 exceeds limit.

◆ getZero() [1/4]

template<typename TYPE >
static constexpr TYPE Math::getZero ( bool  negative)
staticconstexprnoexcept

Returns signed zero.

◆ getZero() [2/4]

template<>
constexpr float Math::getZero ( bool  negative)
inlinestaticconstexprnoexcept

Returns +/- 0 for float.

◆ getZero() [3/4]

template<>
constexpr double Math::getZero ( bool  negative)
inlinestaticconstexprnoexcept

Returns +/- 0 for double.

◆ getZero() [4/4]

template<>
constexpr long double Math::getZero ( bool  negative)
inlinestaticconstexprnoexcept

Returns +/- 0 for long double.

◆ hav()

static long double Math::hav ( long double  value)
inlinestaticnoexcept

Returns the haversine of value.

Examples
testsuite/eval.cpp.

◆ hypot() [1/3]

static double Math::hypot ( double  x,
double  y 
)
inlinestaticnoexcept

Returns the Euclidian distance - sqrt(x^2 + y^2).

◆ hypot() [2/3]

static float Math::hypot ( float  x,
float  y 
)
inlinestaticnoexcept

Returns the Euclidian distance - sqrt(x^2 + y^2).

Examples
testsuite/eval.cpp.

◆ hypot() [3/3]

static long double Math::hypot ( long double  x,
long double  y 
)
inlinestaticnoexcept

Returns the Euclidian distance - sqrt(x^2 + y^2).

◆ iLog2() [1/3]

static unsigned int Math::iLog2 ( unsigned int  value)
inlinestaticnoexcept

Returns the base-2 logarithm of the specified integer. The result is rounded down.

Returns
0 if value is 0.

◆ iLog2() [2/3]

static unsigned int Math::iLog2 ( unsigned long long  value)
inlinestaticnoexcept

Returns the base-2 logarithm of the specified integer. The result is rounded down.

Returns
0 if value is 0.

◆ iLog2() [3/3]

static unsigned int Math::iLog2 ( unsigned long  value)
inlinestaticnoexcept

Returns the base-2 logarithm of the specified integer. The result is rounded down.

Returns
0 if value is 0.

◆ isFinite() [1/3]

static bool Math::isFinite ( double  value)
staticnoexcept

Returns true if value is finite.

◆ isFinite() [2/3]

static bool Math::isFinite ( float  value)
staticnoexcept

Returns true if value is finite.

◆ isFinite() [3/3]

static bool Math::isFinite ( long double  value)
staticnoexcept

Returns true if value is finite.

◆ isInfinity() [1/3]

static bool Math::isInfinity ( double  value)
staticnoexcept

Returns true if value is infinity.

◆ isInfinity() [2/3]

static bool Math::isInfinity ( float  value)
staticnoexcept

Returns true if value is infinity.

◆ isInfinity() [3/3]

static bool Math::isInfinity ( long double  value)
staticnoexcept

Returns true if value is infinity.

◆ isNaN() [1/3]

static bool Math::isNaN ( double  value)
staticnoexcept

Returns true if value is NaN.

◆ isNaN() [2/3]

static bool Math::isNaN ( float  value)
staticnoexcept

Returns true if value is NaN.

◆ isNaN() [3/3]

static bool Math::isNaN ( long double  value)
staticnoexcept

Returns true if value is NaN.

◆ isPowerOf2() [1/3]

static bool Math::isPowerOf2 ( uint32  value)
inlinestaticnoexcept

Returns true if the specified integer is a power of 2.

◆ isPowerOf2() [2/3]

static bool Math::isPowerOf2 ( uint8  value)
inlinestaticnoexcept

Returns true if the specified integer is a power of 2.

◆ isPowerOf2() [3/3]

static bool Math::isPowerOf2 ( unsigned long long  value)
inlinestaticnoexcept

Returns true if the specified integer is a power of 2.

◆ iSqrt()

static unsigned int Math::iSqrt ( unsigned int  value)
inlinestaticnoexcept

Returns the square root of the specified integer. The result is round down.

◆ iSqrt16()

static unsigned int Math::iSqrt16 ( unsigned int  value)
inlinestaticnoexcept

Returns the square root of the specified integer with 16 bit precision. The result is round down.

◆ iSqrt8()

static unsigned int Math::iSqrt8 ( unsigned int  value)
inlinestaticnoexcept

Returns the square root of the specified integer with 8 bit precision. The result is round down.

◆ iSqrt8Round()

static unsigned int Math::iSqrt8Round ( unsigned int  value)
inlinestaticnoexcept

Returns the square root of the specified integer with 8 bit precision. The result is rounded to the nearest 256th of an integer.

◆ lcm() [1/2]

static int Math::lcm ( int  m,
int  n 
)
inlinestaticnoexcept

Returns the least common multiple.

◆ lcm() [2/2]

static unsigned int Math::lcm ( unsigned int  n,
unsigned int  m 
)
inlinestaticnoexcept

Returns the least common multiple.

◆ ln() [1/3]

static double Math::ln ( double  value)
inlinestaticnoexcept

Returns the natural logarithm of the value.

◆ ln() [2/3]

static float Math::ln ( float  value)
inlinestaticnoexcept

Returns the natural logarithm of the value.

Examples
testsuite/eval.cpp.

◆ ln() [3/3]

static long double Math::ln ( long double  value)
inlinestaticnoexcept

Returns the natural logarithm of the value.

◆ lngamma()

static double Math::lngamma ( double  value)
staticnoexcept

Returns the natural logarithm of the gamma of the specified value (i.e. ln(gamma(x))) where gamma is defined as (x - 1)!.

◆ log10() [1/3]

static double Math::log10 ( double  value)
inlinestaticnoexcept

Returns the logarithm with base 10 of the value.

◆ log10() [2/3]

static float Math::log10 ( float  value)
inlinestaticnoexcept

Returns the logarithm with base 10 of the value.

Examples
testsuite/eval.cpp.

◆ log10() [3/3]

static long double Math::log10 ( long double  value)
inlinestaticnoexcept

Returns the logarithm with base 10 of the value.

◆ log2() [1/3]

static double Math::log2 ( double  value)
inlinestaticnoexcept

Returns the logarithm with base 2 of the value.

◆ log2() [2/3]

static float Math::log2 ( float  value)
inlinestaticnoexcept

Returns the logarithm with base 2 of the value.

Examples
testsuite/eval.cpp.

◆ log2() [3/3]

static long double Math::log2 ( long double  value)
inlinestaticnoexcept

Returns the logarithm with base 2 of the value.

◆ logn() [1/3]

static double Math::logn ( double  value,
double  base 
)
inlinestaticnoexcept

Returns the logarithm with base n of the value.

◆ logn() [2/3]

static float Math::logn ( float  value,
float  base 
)
inlinestaticnoexcept

Returns the logarithm with base n of the value.

Examples
testsuite/eval.cpp.

◆ logn() [3/3]

static long double Math::logn ( long double  value,
long double  base 
)
inlinestaticnoexcept

Returns the logarithm with base n of the value.

◆ muldiv()

static uint64 Math::muldiv ( uint64  value,
uint64  mul,
uint64  div 
)
static

Returns value * mul/div while handling overflow.

◆ power() [1/3]

static double Math::power ( double  a,
double  b 
)
inlinestaticnoexcept

Returns the power a^b.

◆ power() [2/3]

static float Math::power ( float  a,
float  b 
)
inlinestaticnoexcept

Returns the power a^b.

Examples
testsuite/eval.cpp.

◆ power() [3/3]

static long double Math::power ( long double  a,
long double  b 
)
inlinestaticnoexcept

Returns the power a^b.

◆ rol()

static unsigned int Math::rol ( unsigned int  value,
unsigned int  count = 1 
)
inlinestaticnoexcept

Rotates the bits of the specified value to the left.

Parameters
valueThe value to be rotated.
countThe number of bit to rotate. The default is 1.

◆ ror()

static unsigned int Math::ror ( unsigned int  value,
unsigned int  count = 1 
)
inlinestaticnoexcept

Rotates the bits of the specified value to the right.

Parameters
valueThe value to be rotated.
countThe number of bit to rotate. The default is 1.

◆ round() [1/3]

static double Math::round ( double  value)
inlinestaticnoexcept

Rounds the value to the nearest integer.

◆ round() [2/3]

static float Math::round ( float  value)
inlinestaticnoexcept

Rounds the value to the nearest integer (away from 0).

Examples
testsuite/eval.cpp.

◆ round() [3/3]

static long double Math::round ( long double  value)
inlinestaticnoexcept

Rounds the value to the nearest integer.

◆ sec()

static long double Math::sec ( long double  value)
inlinestaticnoexcept

Returns the secant of the value.

Examples
testsuite/eval.cpp.

◆ sech() [1/3]

static double Math::sech ( double  value)
inlinestaticnoexcept

Returns the hyperbolic secant of the value.

◆ sech() [2/3]

static float Math::sech ( float  value)
inlinestaticnoexcept

Returns the hyperbolic secant of the value.

Examples
testsuite/eval.cpp.

◆ sech() [3/3]

static long double Math::sech ( long double  value)
inlinestaticnoexcept

Returns the hyperbolic secant of the value.

◆ sin() [1/3]

static double Math::sin ( double  value)
inlinestaticnoexcept

Returns the sine.

◆ sin() [2/3]

static float Math::sin ( float  value)
inlinestaticnoexcept

Returns the sine.

Examples
testsuite/eval.cpp.

◆ sin() [3/3]

static long double Math::sin ( long double  value)
inlinestaticnoexcept

Returns the sine.

◆ sinc() [1/3]

static double Math::sinc ( double  value)
inlinestaticnoexcept

Returns the sinc (with normalization PI) of the value.

◆ sinc() [2/3]

static float Math::sinc ( float  value)
inlinestaticnoexcept

Returns the sinc (with normalization PI) of the value.

◆ sinc() [3/3]

static long double Math::sinc ( long double  value)
inlinestaticnoexcept

Returns the sinc (with normalization PI) of the value.

◆ sincPi() [1/3]

static double Math::sincPi ( double  value)
inlinestaticnoexcept

Returns the sinc (with normalization 1) of the value.

◆ sincPi() [2/3]

static float Math::sincPi ( float  value)
inlinestaticnoexcept

Returns the sinc (with normalization 1) of the value.

◆ sincPi() [3/3]

static long double Math::sincPi ( long double  value)
inlinestaticnoexcept

Returns the sinc (with normalization 1) of the value.

◆ sinh() [1/3]

static double Math::sinh ( double  value)
inlinestaticnoexcept

Returns the hyperbolic sine.

◆ sinh() [2/3]

static float Math::sinh ( float  value)
inlinestaticnoexcept

Returns the hyperbolic sine.

Examples
testsuite/eval.cpp.

◆ sinh() [3/3]

static long double Math::sinh ( long double  value)
inlinestaticnoexcept

Returns the hyperbolic sine.

◆ sqrt() [1/3]

static double Math::sqrt ( double  value)
inlinestaticnoexcept

Returns the square root of the value.

◆ sqrt() [2/3]

static float Math::sqrt ( float  value)
inlinestaticnoexcept

Returns the square root of the value.

Examples
testsuite/eval.cpp.

◆ sqrt() [3/3]

static long double Math::sqrt ( long double  value)
inlinestaticnoexcept

Returns the square root of the value.

◆ subtractBorrow() [1/4]

static uint16 Math::subtractBorrow ( uint16 &  value,
const uint16  subtrahend 
)
inlinestaticnoexcept

Returns 1 on borrow for subtraction.

◆ subtractBorrow() [2/4]

static uint32 Math::subtractBorrow ( uint32 &  value,
const uint32  subtrahend 
)
inlinestaticnoexcept

Returns 1 on borrow for subtraction.

◆ subtractBorrow() [3/4]

static uint64 Math::subtractBorrow ( uint64 &  value,
const uint64  subtrahend 
)
inlinestaticnoexcept

Returns 1 on borrow for subtraction.

◆ subtractBorrow() [4/4]

static uint8 Math::subtractBorrow ( uint8 &  value,
const uint8  subtrahend 
)
inlinestaticnoexcept

Returns 1 on borrow for subtraction.

◆ tan() [1/3]

static double Math::tan ( double  value)
inlinestaticnoexcept

Returns the tangent.

◆ tan() [2/3]

static float Math::tan ( float  value)
inlinestaticnoexcept

Returns the tangent.

Examples
testsuite/eval.cpp.

◆ tan() [3/3]

static long double Math::tan ( long double  value)
inlinestatic

Returns the tangent.

◆ tanc() [1/3]

static double Math::tanc ( double  value)
inlinestaticnoexcept

Returns the tanc of the value.

◆ tanc() [2/3]

static float Math::tanc ( float  value)
inlinestaticnoexcept

Returns the tanc of the value.

◆ tanc() [3/3]

static long double Math::tanc ( long double  value)
inlinestaticnoexcept

Returns the tanc of the value.

◆ tanh() [1/3]

static double Math::tanh ( double  value)
inlinestaticnoexcept

Returns the hyperbolic tangent.

◆ tanh() [2/3]

static float Math::tanh ( float  value)
inlinestaticnoexcept

Returns the hyperbolic tangent.

Examples
testsuite/eval.cpp.

◆ tanh() [3/3]

static long double Math::tanh ( long double  value)
inlinestaticnoexcept

Returns the hyperbolic tangent.

◆ trunc() [1/3]

static double Math::trunc ( double  value)
inlinestaticnoexcept

Rounds (towards zero) the value to the nearest integer.

◆ trunc() [2/3]

static float Math::trunc ( float  value)
inlinestaticnoexcept

Rounds (towards zero) the value to the nearest integer.

◆ trunc() [3/3]

static long double Math::trunc ( long double  value)
inlinestaticnoexcept

Rounds (towards zero) the value to the nearest integer.

◆ vers()

static long double Math::vers ( long double  value)
inlinestaticnoexcept

Returns versine of value.

Examples
testsuite/eval.cpp.

Member Data Documentation

◆ EXPONENTS10_32

const int32 Math::EXPONENTS10_32[10]
static

Power of 10 exponents in 32-bit.

◆ EXPONENTS10_64

const int64 Math::EXPONENTS10_64[19]
static

Power of 10 exponents in 64-bit.

◆ EXPONENTS2_32

const int32 Math::EXPONENTS2_32[31]
static

Power of 2 exponents in 32-bit.

◆ EXPONENTS2_64

const int64 Math::EXPONENTS2_64[63]
static

Power of 2 exponents in 64-bit.

◆ EXPONENTS5_32

const int32 Math::EXPONENTS5_32[14]
static

Power of 5 exponents in 32-bit.

◆ EXPONENTS5_64

const int64 Math::EXPONENTS5_64[28]
static

Power of 5 exponents in 64-bit.