Base Framework
|
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] |
Mathematical functions.
This class is a placeholder for mathematical functions.
|
inlinestaticnoexcept |
Returns the absolute value.
|
inlinestaticnoexcept |
Returns the absolute value.
|
inlinestaticnoexcept |
Returns the absolute value.
|
inlinestaticnoexcept |
Returns the inverse cosine.
|
inlinestaticnoexcept |
Returns the inverse cosine.
|
inlinestaticnoexcept |
Returns the inverse cosine.
|
inlinestaticnoexcept |
Returns the inverse cosecant of the value.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cosecant of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cosecant of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cosecant of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cosine.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cosine.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cosine.
|
inlinestaticnoexcept |
Returns the inverse cotangent of the value.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cotangent of the value.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cotangent of the value.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic cotangent of the value.
|
inlinestaticnoexcept |
Returns the inverse coversine of the value.
|
inlinestaticnoexcept |
Returns the carry for the addition.
|
inlinestaticnoexcept |
Returns the carry for the addition.
|
inlinestaticnoexcept |
Returns the carry for the addition.
|
inlinestaticnoexcept |
Returns the carry for the addition.
|
inlinestaticnoexcept |
Returns the inverse exsecant of the value.
|
inlinestaticnoexcept |
Returns the inverse hav of the value.
|
inlinestaticnoexcept |
Returns the inverse secant of the value.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic secant of the value.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic secant of the value.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic secant of the value.
|
inlinestaticnoexcept |
Returns the inverse sine.
|
inlinestaticnoexcept |
Returns the inverse sine.
|
inlinestaticnoexcept |
Returns the inverse sine.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic sine.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic sine.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic sine.
|
inlinestaticnoexcept |
Returns the inverse tangent.
|
inlinestaticnoexcept |
Returns the inverse tangent.
|
inlinestaticnoexcept |
Returns the inverse tangent.
|
inlinestaticnoexcept |
Returns the arc tangent of y/x using the signs of both arguments to determine the proper quadrant.
|
inlinestaticnoexcept |
Returns the arc tangent of y/x using the signs of both arguments to determine the proper quadrant.
|
inlinestaticnoexcept |
Returns the arc tangent of y/x using the signs of both arguments to determine the proper quadrant.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic tangent.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic tangent.
|
inlinestaticnoexcept |
Returns the inverse hyperbolic tangent.
|
inlinestaticnoexcept |
Returns the inverse versine of the value.
|
inlinestaticnoexcept |
Returns the cube root of the value.
|
inlinestaticnoexcept |
Returns the cube root of the value.
|
inlinestaticnoexcept |
Returns the cube root of the value.
|
inlinestaticnoexcept |
Rounds (towards +infinity) the value to the nearest integer.
|
inlinestaticnoexcept |
Rounds (towards +infinity) the value to the nearest integer.
|
inlinestaticnoexcept |
Rounds (towards +infinity) the value to the nearest integer.
|
inlinestaticnoexcept |
Returns the cosine.
|
inlinestaticnoexcept |
Returns the cosine.
|
inlinestaticnoexcept |
Returns the cosine.
|
inlinestaticnoexcept |
Returns the cosecant of the value.
|
inlinestaticnoexcept |
Returns the hyperbolic cosecant of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the hyperbolic cosecant of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the hyperbolic cosecant of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the hyperbolic cosine.
|
inlinestaticnoexcept |
Returns the hyperbolic cosine.
|
inlinestaticnoexcept |
Returns the hyperbolic cosine.
|
inlinestaticnoexcept |
Returns the cotangent of the value.
|
inlinestaticnoexcept |
Returns the hyperbolic cotangent of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the hyperbolic cotangent of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the hyperbolic cotangent of the value (do not invoke for 0).
|
inlinestaticnoexcept |
Returns the coversine of value.
|
inlinestaticnoexcept |
Returns the exponential of the value.
|
inlinestaticnoexcept |
Returns the exponential of the value.
|
inlinestaticnoexcept |
Returns the exponential of the value.
|
inlinestaticnoexcept |
Returns the exsecant of the value.
|
inlinestaticnoexcept |
Rounds (towards -infinity) the value to the nearest integer.
|
inlinestaticnoexcept |
Rounds (towards -infinity) the value to the nearest integer.
|
inlinestaticnoexcept |
Rounds (towards -infinity) the value to the nearest integer.
|
staticnoexcept |
Returns the fraction.
|
staticnoexcept |
Returns the fraction.
|
staticnoexcept |
Returns the fraction.
|
staticnoexcept |
Returns the greatest common divisor.
|
staticnoexcept |
Returns the greatest common divisor.
|
inlinestaticnoexcept |
Returns the bit reversal of the specified 16 bit unsigned integer.
|
inlinestaticnoexcept |
Returns the bit reversal of the specified 32 bit unsigned integer.
|
inlinestaticnoexcept |
Returns the bit reversal of the specified 64 bit unsigned integer.
|
inlinestaticnoexcept |
Returns the bit reversal of the specified 8 bit unsigned integer.
|
inlinestaticnoexcept |
Returns the bit index of the highest set bit.
|
inlinestaticnoexcept |
Returns the bit index of the highest set bit.
|
inlinestaticnoexcept |
Returns the bit index of the highest set bit.
|
inlinestaticnoexcept |
Returns the bit index of the highest set bit.
|
inlinestaticnoexcept |
Returns the bit index of the highest set bit.
|
staticconstexprnoexcept |
Returns infinity. You get negative infinity by using - operator.
|
inlinestaticnoexcept |
Returns +infinity for float.
|
inlinestaticnoexcept |
Returns +infinity for double.
|
inlinestaticnoexcept |
Returns +infinity for long double.
|
staticconstexprnoexcept |
Returns quiet NaN. Signaling NaN should be avoided due to platform inconsistencies.
|
inlinestaticnoexcept |
Returns quiet NaN for float.
|
inlinestaticnoexcept |
Returns quiet NaN for double.
|
inlinestaticnoexcept |
Returns quiet NaN for long double.
|
inlinestaticnoexcept |
Returns the power of 2 greater than or equal to the specified value.
|
inlinestaticnoexcept |
Returns the power of 2 greater than or equal to the specified value.
|
inlinestaticnoexcept |
Returns the power of 2 greater than or equal to the specified value.
|
staticconstexprnoexcept |
Returns signed zero.
|
inlinestaticconstexprnoexcept |
Returns +/- 0 for float.
|
inlinestaticconstexprnoexcept |
Returns +/- 0 for double.
|
inlinestaticconstexprnoexcept |
Returns +/- 0 for long double.
|
inlinestaticnoexcept |
Returns the haversine of value.
|
inlinestaticnoexcept |
Returns the Euclidian distance - sqrt(x^2 + y^2).
|
inlinestaticnoexcept |
Returns the Euclidian distance - sqrt(x^2 + y^2).
|
inlinestaticnoexcept |
Returns the Euclidian distance - sqrt(x^2 + y^2).
|
inlinestaticnoexcept |
Returns the base-2 logarithm of the specified integer. The result is rounded down.
|
inlinestaticnoexcept |
Returns the base-2 logarithm of the specified integer. The result is rounded down.
|
inlinestaticnoexcept |
Returns the base-2 logarithm of the specified integer. The result is rounded down.
|
staticnoexcept |
Returns true if value is finite.
|
staticnoexcept |
Returns true if value is finite.
|
staticnoexcept |
Returns true if value is finite.
|
staticnoexcept |
Returns true if value is infinity.
|
staticnoexcept |
Returns true if value is infinity.
|
staticnoexcept |
Returns true if value is infinity.
|
staticnoexcept |
Returns true if value is NaN.
|
staticnoexcept |
Returns true if value is NaN.
|
staticnoexcept |
Returns true if value is NaN.
|
inlinestaticnoexcept |
Returns true if the specified integer is a power of 2.
|
inlinestaticnoexcept |
Returns true if the specified integer is a power of 2.
|
inlinestaticnoexcept |
Returns true if the specified integer is a power of 2.
|
inlinestaticnoexcept |
Returns the square root of the specified integer. The result is round down.
|
inlinestaticnoexcept |
Returns the square root of the specified integer with 16 bit precision. The result is round down.
|
inlinestaticnoexcept |
Returns the square root of the specified integer with 8 bit precision. The result is round down.
|
inlinestaticnoexcept |
Returns the square root of the specified integer with 8 bit precision. The result is rounded to the nearest 256th of an integer.
|
inlinestaticnoexcept |
Returns the least common multiple.
|
inlinestaticnoexcept |
Returns the least common multiple.
|
inlinestaticnoexcept |
Returns the natural logarithm of the value.
|
inlinestaticnoexcept |
Returns the natural logarithm of the value.
|
inlinestaticnoexcept |
Returns the natural logarithm of the 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)!.
|
inlinestaticnoexcept |
Returns the logarithm with base 10 of the value.
|
inlinestaticnoexcept |
Returns the logarithm with base 10 of the value.
|
inlinestaticnoexcept |
Returns the logarithm with base 10 of the value.
|
inlinestaticnoexcept |
Returns the logarithm with base 2 of the value.
|
inlinestaticnoexcept |
Returns the logarithm with base 2 of the value.
|
inlinestaticnoexcept |
Returns the logarithm with base 2 of the value.
|
inlinestaticnoexcept |
Returns the logarithm with base n of the value.
|
inlinestaticnoexcept |
Returns the logarithm with base n of the value.
|
inlinestaticnoexcept |
Returns the logarithm with base n of the value.
|
static |
Returns value * mul/div while handling overflow.
|
inlinestaticnoexcept |
Returns the power a^b.
|
inlinestaticnoexcept |
Returns the power a^b.
|
inlinestaticnoexcept |
Returns the power a^b.
|
inlinestaticnoexcept |
Rotates the bits of the specified value to the left.
value | The value to be rotated. |
count | The number of bit to rotate. The default is 1. |
|
inlinestaticnoexcept |
Rotates the bits of the specified value to the right.
value | The value to be rotated. |
count | The number of bit to rotate. The default is 1. |
|
inlinestaticnoexcept |
Rounds the value to the nearest integer.
|
inlinestaticnoexcept |
Rounds the value to the nearest integer (away from 0).
|
inlinestaticnoexcept |
Rounds the value to the nearest integer.
|
inlinestaticnoexcept |
Returns the secant of the value.
|
inlinestaticnoexcept |
Returns the hyperbolic secant of the value.
|
inlinestaticnoexcept |
Returns the hyperbolic secant of the value.
|
inlinestaticnoexcept |
Returns the hyperbolic secant of the value.
|
inlinestaticnoexcept |
Returns the sine.
|
inlinestaticnoexcept |
Returns the sine.
|
inlinestaticnoexcept |
Returns the sine.
|
inlinestaticnoexcept |
Returns the sinc (with normalization PI) of the value.
|
inlinestaticnoexcept |
Returns the sinc (with normalization PI) of the value.
|
inlinestaticnoexcept |
Returns the sinc (with normalization PI) of the value.
|
inlinestaticnoexcept |
Returns the sinc (with normalization 1) of the value.
|
inlinestaticnoexcept |
Returns the sinc (with normalization 1) of the value.
|
inlinestaticnoexcept |
Returns the sinc (with normalization 1) of the value.
|
inlinestaticnoexcept |
Returns the hyperbolic sine.
|
inlinestaticnoexcept |
Returns the hyperbolic sine.
|
inlinestaticnoexcept |
Returns the hyperbolic sine.
|
inlinestaticnoexcept |
Returns the square root of the value.
|
inlinestaticnoexcept |
Returns the square root of the value.
|
inlinestaticnoexcept |
Returns the square root of the value.
|
inlinestaticnoexcept |
Returns 1 on borrow for subtraction.
|
inlinestaticnoexcept |
Returns 1 on borrow for subtraction.
|
inlinestaticnoexcept |
Returns 1 on borrow for subtraction.
|
inlinestaticnoexcept |
Returns 1 on borrow for subtraction.
|
inlinestaticnoexcept |
Returns the tangent.
|
inlinestaticnoexcept |
Returns the tangent.
|
inlinestatic |
Returns the tangent.
|
inlinestaticnoexcept |
Returns the tanc of the value.
|
inlinestaticnoexcept |
Returns the tanc of the value.
|
inlinestaticnoexcept |
Returns the tanc of the value.
|
inlinestaticnoexcept |
Returns the hyperbolic tangent.
|
inlinestaticnoexcept |
Returns the hyperbolic tangent.
|
inlinestaticnoexcept |
Returns the hyperbolic tangent.
|
inlinestaticnoexcept |
Rounds (towards zero) the value to the nearest integer.
|
inlinestaticnoexcept |
Rounds (towards zero) the value to the nearest integer.
|
inlinestaticnoexcept |
Rounds (towards zero) the value to the nearest integer.
|
inlinestaticnoexcept |
Returns versine of value.
|
static |
Power of 10 exponents in 32-bit.
|
static |
Power of 10 exponents in 64-bit.
|
static |
Power of 2 exponents in 32-bit.
|
static |
Power of 2 exponents in 64-bit.
|
static |
Power of 5 exponents in 32-bit.
|
static |
Power of 5 exponents in 64-bit.