Documentation
Tools for embedded systems
|
Fast floating-point math library for applications where speed is more important than accuracy. More...
Classes | |
struct | qlibs::ffmath::numbers |
Provides several mathematical constants as single-precision floating-point numbers. More... | |
Enumerations | |
enum class | qlibs::ffmath::classification { qlibs::ffmath::classification::FFP_ZERO , qlibs::ffmath::classification::FFP_SUBNORMAL , qlibs::ffmath::classification::FFP_NORMAL , qlibs::ffmath::classification::FFP_INFINITE , qlibs::ffmath::classification::FFP_NAN } |
Enum with the possible categorizations of a 32-bit floating-point number. More... | |
Functions | |
bool | qlibs::ffmath::isEqual (const float a, const float b, const float tol=1.175494351e-38F) noexcept |
Determines if the parameters given as floating-point values are approximately equal. | |
float | qlibs::ffmath::getInf (void) |
Returns positive infinity inf as a 32-bit floating point number. | |
float | qlibs::ffmath::getNan (void) |
Returns Not a Number ( NaN ) nan as a 32-bit floating point number. | |
classification | qlibs::ffmath::classify (const float f) |
Categorizes the floating-point number x. This function determines whether its argument is a normal floating-point number, or one of several special categories of values, including NaN (not a number), infinity, subnormal floating-point values or zero. To determine what category the argument belongs to, compare the return value with the any of the following number classification macros: | |
template<typename T , typename... Args> | |
T | qlibs::ffmath::Max (const T &first, const Args &... args) |
Finds the maximum value among the provided arguments. | |
template<typename T , typename... Args> | |
T | qlibs::ffmath::Min (const T &first, const Args &... args) |
Finds the minimum value among the provided arguments. | |
bool | qlibs::ffmath::isNan (const float x) |
Determine if x is Not-A-Number NaN. | |
bool | qlibs::ffmath::isInf (const float x) |
Determine if x is Infinity. | |
bool | qlibs::ffmath::isFinite (const float x) |
Determines if the given floating point number x has finite value i.e. it is normal, subnormal or zero, but not infinite or NaN. | |
bool | qlibs::ffmath::isNormal (const float x) |
Determines if the given floating point number x is normal, i.e. is neither zero, subnormal, infinite, or NaN. | |
float | qlibs::ffmath::copysign (float mag, float sgn) |
Composes a floating point value with the magnitude of mag and the sign of sgn. | |
float | qlibs::ffmath::sign (float x) |
Computes the sign function ( signum function). | |
float | qlibs::ffmath::absf (float x) |
Computes the absolute value of a floating point value x. | |
float | qlibs::ffmath::recip (float x) |
Computes the multiplicative inverse or reciprocal for the value x, denoted by 1/x or x^(−1) | |
float | qlibs::ffmath::sqrt (float x) |
Computes the square-root of x. | |
float | qlibs::ffmath::rSqrt (float x) |
Computes the reciprocal square-root of x denoted as 1/sqrt(x) | |
float | qlibs::ffmath::cbrt (float x) |
Computes the cubic-root of x. | |
float | qlibs::ffmath::rCbrt (float x) |
Computes the reciprocal cubic-root of x denoted as 1/cbrt(x) | |
float | qlibs::ffmath::rounding (float x) |
Computes the nearest integer value to x (in floating-point format), rounding halfway cases away from zero. | |
float | qlibs::ffmath::floor (float x) |
Computes the largest integer value not greater than x. | |
float | qlibs::ffmath::ceil (float x) |
Computes the smallest integer value not less than x. | |
float | qlibs::ffmath::trunc (float x) |
Computes the nearest integer not greater in magnitude than x. | |
float | qlibs::ffmath::frac (float x) |
Obtain the fractional part of x. | |
float | qlibs::ffmath::rem (float x, float y) |
Computes the floating point remainder after division of x by y, where x is the dividend and y is the divisor. This function is often called the remainder operation, which can be expressed as r=a-(b*trunc(a/b)) . This function follows the convention that rem(x,0) is nan . | |
float | qlibs::ffmath::mod (float x, float y) |
Computes the floating point remainder after division of x by y, where x is the dividend and y is the divisor. This function is often called the modulo operation, which can be expressed as b=a-m*floor(a/m) . This function follows the convention that mod(x,0) returns x. | |
float | qlibs::ffmath::sin (float x) |
Computes the sine of x (measured in radians). | |
float | qlibs::ffmath::cos (float x) |
Computes the cosine of x (measured in radians). | |
float | qlibs::ffmath::tan (float x) |
Computes the tangent of x (measured in radians). | |
float | qlibs::ffmath::asin (float x) |
Computes the principal value of the arc sine of x. | |
float | qlibs::ffmath::acos (float x) |
Computes the principal value of the arc cosine of x. | |
float | qlibs::ffmath::atan (float x) |
Computes the principal value of the arc tangent of x. | |
float | qlibs::ffmath::atan2 (float y, float x) |
Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant. | |
float | qlibs::ffmath::exp2 (float x) |
Computes 2 raised to the given power x. | |
float | qlibs::ffmath::log2 (float x) |
Computes the base 2 logarithm of x. | |
float | qlibs::ffmath::exp (float x) |
Computes the e ( Euler's number, 2.7182818 ) raised to the given power x. | |
float | qlibs::ffmath::expm1 (float x) |
Returns e raised to the given power minus one e^x-1 power x. | |
float | qlibs::ffmath::exp10 (float x) |
Computes the value of 10 raised to the power of x. | |
float | qlibs::ffmath::log (float x) |
Computes the natural (base e) logarithm of x. | |
float | qlibs::ffmath::log1p (float x) |
Computes the natural (base e) logarithm of 1 plus the given number x ln (1+x) . | |
float | qlibs::ffmath::log10 (float x) |
Computes the common (base-10) logarithm of x. | |
float | qlibs::ffmath::pow (float b, float e) |
Computes the value of b raised to the power e. | |
float | qlibs::ffmath::sinh (float x) |
Computes hyperbolic sine of x. | |
float | qlibs::ffmath::cosh (float x) |
Computes hyperbolic cosine of x. | |
float | qlibs::ffmath::tanh (float x) |
Computes hyperbolic tangent of x. | |
float | qlibs::ffmath::asinh (float x) |
Computes the inverse hyperbolic sine of x. | |
float | qlibs::ffmath::acosh (float x) |
Computes the inverse hyperbolic cosine of x. | |
float | qlibs::ffmath::atanh (float x) |
Computes the inverse hyperbolic tangent of x. | |
float | qlibs::ffmath::wrapToPi (float x) |
Wraps angle x, in radians, to the interval [−pi, pi] such that pi maps to pi and −pi maps to −pi . In general, odd, positive multiples of pi map to pi and odd, negative multiples of pi map to −pi . | |
float | qlibs::ffmath::wrapTo2Pi (float x) |
Wraps angle x, in radians, to the interval [0, 2*pi] such that 0 maps to 0 and 2*pi and 2*pi maps to 2*pi . In general, positive multiples of 2*pi map to 2*pi and negative multiples of 2*pi map to 0 . | |
float | qlibs::ffmath::wrapTo180 (float x) |
Wraps angle x, in degrees, to the interval [–180, 180] such that 180 maps to 180 and –180 maps to –180 . In general, odd, positive multiples of 180 map to 180 and odd, negative multiples of 180 map to –180 . | |
float | qlibs::ffmath::wrapTo360 (float x) |
Wraps angle x, in degrees, to the interval [0, 360] such that 0 maps to 0 and 360 maps to 360 . In general, positive multiples of 360 map to 360 and negative multiples of 360 map to zero. | |
float | qlibs::ffmath::midpoint (float a, float b) |
Computes the midpoint of the floating-points a and b. | |
float | qlibs::ffmath::lerp (float a, float b, float t) |
Computes the linear interpolation between a and b, if the parameter t is inside [0, 1] (the linear extrapolation otherwise), i.e. the result of a+t*(b-a) with accounting for floating-point calculation imprecision. | |
float | qlibs::ffmath::map (const float x, const float xMin, const float xMax, const float yMin, const float yMax) noexcept |
Scales the given input x in value range given by xMin and xMax to value range specified by the yMin and yMax. | |
real_t | qlibs::ffmath::normalize (const float x, const float xMin, const float xMax) noexcept |
Normalize the given input x in value range given by xMin and xMax to value range between 0 and 1. | |
bool | qlibs::ffmath::inRangeCoerce (float &x, const float lowerL, const float upperL) noexcept |
Determines if the value pointed by x falls within a range specified by the upper limit and lower limit inputs and coerces the value to fall within the range. | |
bool | qlibs::ffmath::inPolygon (const float x, const float y, const float *const px, const float *const py, const size_t p) noexcept |
Determines if the point at ( x, y ) is inside the polygon given by the set of points on px and py. | |
bool | qlibs::ffmath::inCircle (const float x, const float y, const float cx, const float cy, const float r) noexcept |
Determines if the point at ( x, y) is inside the circle with radius r located at cx and cy. | |
float | qlibs::ffmath::erf (float x) |
Computes the error function of x. | |
float | qlibs::ffmath::erfc (float x) |
Computes the complementary error function of x. | |
float | qlibs::ffmath::rexp (float x, int32_t *pw2) |
Decomposes given floating point value x into a normalized fraction and an integral power of two. | |
float | qlibs::ffmath::ldexp (float x, int32_t pw2) |
Multiplies a floating point value x by the number 2 raised to the pw2 power. | |
float | qlibs::ffmath::hypot (float x, float y) |
Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation. | |
float | qlibs::ffmath::nextAfter (float x, float y) |
Returns the next representable value of x in the direction of y. If x equals to y, y is returned. | |
float | qlibs::ffmath::tgamma (float x) |
Computes the gamma function of x. | |
float | qlibs::ffmath::lgamma (float x) |
Computes the natural logarithm of the absolute value of the gamma function of x. | |
float | qlibs::ffmath::factorial (float x) |
Return the factorial of the integer part of x. | |
float | qlibs::ffmath::assoc_laguerre (size_t n, size_t m, float x) |
Computes the associated Laguerre polynomials of the degree n, order m, and argument x. | |
float | qlibs::ffmath::assoc_legendre (size_t n, size_t m, float x) |
Computes the associated Legendre polynomials of the degree n, order m, and argument x. | |
float | qlibs::ffmath::beta (float x, float y) |
Computes the Beta function of x and y. | |
float | qlibs::ffmath::comp_ellint_1 (float k) |
Computes the complete elliptic integral of the first kind of k. | |
float | qlibs::ffmath::comp_ellint_2 (float k) |
Computes the complete elliptic integral of the second kind of k. | |
float | qlibs::ffmath::comp_ellint_3 (float k, float nu) |
Computes the complete elliptic integral of the third kind of k and nu. | |
float | qlibs::ffmath::ellint_1 (float k, float phi) |
Computes the incomplete elliptic integral of the first kind of k and phi. | |
float | qlibs::ffmath::ellint_2 (float k, float phi) |
Computes the incomplete elliptic integral of the second kind of k and phi. | |
float | qlibs::ffmath::ellint_3 (float k, float nu, float phi) |
Computes the incomplete elliptic integral of the third kind of k, nu and phi. | |
float | qlibs::ffmath::expint (float num) |
Computes the Exponential integral of num. | |
float | qlibs::ffmath::hermite (size_t n, float x) |
Computes the (physicist's) Hermite polynomials of the degree n and argument x. | |
float | qlibs::ffmath::laguerre (size_t n, float x) |
Computes the non-associated Laguerre polynomials of the degree n, and argument x. | |
float | qlibs::ffmath::legendre (size_t n, float x) |
Computes the unassociated Legendre polynomials of the degree n, and argument x. | |
float | qlibs::ffmath::riemann_zeta (float s) |
Computes the Riemann zeta function of s. | |
float | qlibs::ffmath::sph_bessel (size_t n, float x) |
Computes the spherical Bessel function of the first kind n, and x. | |
float | qlibs::ffmath::sph_neumann (size_t n, float x) |
Computes the spherical Bessel function of the second kind also known as the spherical Neumann function of n and x. | |
float | qlibs::ffmath::cyl_bessel_i (float nu, float x) |
Computes the regular modified cylindrical Bessel function of nu and x. | |
float | qlibs::ffmath::cyl_bessel_j (float nu, float x) |
Computes the cylindrical Bessel function of the first kind of nu and x. | |
float | qlibs::ffmath::cyl_bessel_k (float nu, float x) |
Computes the irregular modified cylindrical Bessel function (also known as modified Bessel function of the second kind) of nu and x. | |
float | qlibs::ffmath::cyl_neumann (float nu, float x) |
Computes the cylindrical Neumann function ( also known as Bessel function of the second kind or Weber function) of nu and x. | |
float | qlibs::ffmath::sph_legendre (size_t l, size_t m, float theta) |
1-3) Computes the spherical associated Legendre function of degree l, order m, and polar angle theta | |
Variables | |
constexpr float | qlibs::ffmath::FFP_E |
The base of natural logarithms ( e ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_LOG2E |
The base 2 logarithm of e ( log_2 e ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_LOG10E |
The base 10 logarithm of e ( log_10 e ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_LN2 |
The natural logarithm of 2 ( ln 2 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_LN10 |
The natural logarithm of 10 ( ln 10 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_PI |
The circumference of a circle with diameter 1, ( π ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_2PI |
Twice circumference of a circle with diameter 1, ( 2π ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_PI_2 |
Half of π ( π/2 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_PI_4 |
A quarter of π ( π/4 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_1_PI |
The inverse of π ( 1/π ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_2_PI |
Twice the inverse of π ( 2/π ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_1_SQRTPI |
The inverse of the square root of π ( 1/√π ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_2_SQRTPI |
Twice the inverse of the square root of π ( 1/√π ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_SQRT2 |
The square root of 2 ( √2 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_SQRT3 |
The square root of 3 ( √3 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_SQRT1_2 |
The inverse of square root of 2 ( 1/√2 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_SQRT1_3 |
The inverse of square root of 3 ( 1/√3 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_LN_SQRT_2PI |
The natural logarithm of the square root of 2π given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_GAMMA_E |
Constant Euler-Mascheroni given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_PHI |
The golden ratio, (1+√5)/2 given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_RADIAN |
Radian, value of ( 180/π ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_LOG10_2 |
The base 10 logarithm of 2 ( log_10 2 ) given as a single-precision floating-point number. | |
constexpr float | qlibs::ffmath::FFP_LN_PI |
The natural logarithm of π ( ln(π) ) given as a single-precision floating-point number. | |
Fast floating-point math library for applications where speed is more important than accuracy.
|
strong |
Enum with the possible categorizations of a 32-bit floating-point number.
float qlibs::ffmath::absf | ( | float | x | ) |
Computes the absolute value of a floating point value x.
[in] | x | The floating point value |
float qlibs::ffmath::acos | ( | float | x | ) |
Computes the principal value of the arc cosine of x.
[in] | x | The floating point value |
arccos(x)
in the range [0 ; pi]
. is returned.If the domain validation fails, a nan
value is returned. float qlibs::ffmath::acosh | ( | float | x | ) |
Computes the inverse hyperbolic cosine of x.
[in] | x | The floating point value |
cosh^-1(x)
is returned. float qlibs::ffmath::asin | ( | float | x | ) |
Computes the principal value of the arc sine of x.
[in] | x | The floating point value |
arcsin(x)
in the range [-pi/2 ; pi/2]
. is returned.If the domain validation fails, a nan
value is returned. float qlibs::ffmath::asinh | ( | float | x | ) |
Computes the inverse hyperbolic sine of x.
[in] | x | The floating point value |
sinh^-1(x)
is returned. float qlibs::ffmath::assoc_laguerre | ( | size_t | n, |
size_t | m, | ||
float | x ) |
Computes the associated Laguerre polynomials of the degree n, order m, and argument x.
[in] | n | The degree of the polynomial, an unsigned integer value |
[in] | m | The order of the polynomial, an unsigned integer value |
[in] | x | The argument, a floating-point or integer value |
nan
, a nan
is returned. If x is negative, nan
is returned. If n or m is greater or equal to 128
, the behavior is implementation-defined. float qlibs::ffmath::assoc_legendre | ( | size_t | n, |
size_t | m, | ||
float | x ) |
Computes the associated Legendre polynomials of the degree n, order m, and argument x.
[in] | n | The degree of the polynomial, an unsigned integer value |
[in] | m | The order of the polynomial, an unsigned integer value |
[in] | x | The argument, a floating-point or integer value |
nan
, a nan
is returned. If |x| > 1
, nan
is returned due the domain error. If n is greater or equal to 128
, the behavior is implementation-defined. float qlibs::ffmath::atan | ( | float | x | ) |
Computes the principal value of the arc tangent of x.
[in] | x | The floating point value |
arctan(x)
in the range [-pi/2 ; pi/2]
. is returned.If the domain validation fails, a nan
value is returned. float qlibs::ffmath::atan2 | ( | float | y, |
float | x ) |
Computes the arc tangent of y/x
using the signs of arguments to determine the correct quadrant.
[in] | y | The floating point value |
[in] | x | The floating point value |
y/x
arctan(y/x)
in the range [-pi ; +pi]
radians, is returned. If the domain validation fails, a nan
value is returned. float qlibs::ffmath::atanh | ( | float | x | ) |
Computes the inverse hyperbolic tangent of x.
[in] | x | The floating point value |
tanh^-1(x)
is returned. If the domain validation fails, a nan
value is returned. If the pole validation fails, ±inf
is returned. float qlibs::ffmath::beta | ( | float | x, |
float | y ) |
Computes the Beta function of x and y.
[in] | x | The argument, a floating-point or integer value |
[in] | y | The argument, a floating-point or integer value |
nan
, nan
is returned. The function is only required to be defined where both x and y are greater than zero, and is allowed to return nan
otherwise. float qlibs::ffmath::cbrt | ( | float | x | ) |
Computes the cubic-root of x.
[in] | x | The floating point value |
nan
is returned float qlibs::ffmath::ceil | ( | float | x | ) |
Computes the smallest integer value not less than x.
[in] | x | The floating point value |
ffmath::classification qlibs::ffmath::classify | ( | const float | f | ) |
Categorizes the floating-point number x. This function determines whether its argument is a normal floating-point number, or one of several special categories of values, including NaN (not a number), infinity, subnormal floating-point values or zero. To determine what category the argument belongs to, compare the return value with the any of the following number classification macros:
[in] | f | The number you want to test. |
float qlibs::ffmath::comp_ellint_1 | ( | float | k | ) |
Computes the complete elliptic integral of the first kind of k.
[in] | k | Elliptic modulus or eccentricity as a floating-point value |
nan
, nan
is returned. If |k| > 1
, NaN is returned due the domain error float qlibs::ffmath::comp_ellint_2 | ( | float | k | ) |
Computes the complete elliptic integral of the second kind of k.
[in] | k | Elliptic modulus or eccentricity as a floating-point value |
nan
, nan
is returned. If |k| > 1
, nan
is returned due the domain error float qlibs::ffmath::comp_ellint_3 | ( | float | k, |
float | nu ) |
Computes the complete elliptic integral of the third kind of k and nu.
[in] | k | Elliptic modulus or eccentricity as a floating-point value |
[in] | nu | Elliptic characteristic as a floating-point value |
nan
, nan
is returned. If |k| > 1
, nan
is returned due the domain error float qlibs::ffmath::copysign | ( | float | mag, |
float | sgn ) |
Composes a floating point value with the magnitude of mag and the sign of sgn.
[in] | mag | floating-point value. |
[in] | sgn | floating-point value |
nan
, then nan
with the sign of sgn is returned. if sgn
is -0
, the result is only negative if the implementation supports the signed zero consistently in arithmetic operations. float qlibs::ffmath::cos | ( | float | x | ) |
Computes the cosine of x (measured in radians).
[in] | x | The floating point value |
cos(x)
in the range [-1 ; +1]
, is returned. If the domain validation fails, a nan
value is returned. float qlibs::ffmath::cosh | ( | float | x | ) |
Computes hyperbolic cosine of x.
[in] | x | The floating point value |
cosh(x)
is returned. If the range validation fails, a inf
value is returned. float qlibs::ffmath::cyl_bessel_i | ( | float | nu, |
float | x ) |
Computes the regular modified cylindrical Bessel function of nu and x.
[in] | nu | The order of the function |
[in] | x | The argument to the function, a floating-point or integer value |
nan
, a nan
is returned. If nu is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::cyl_bessel_j | ( | float | nu, |
float | x ) |
Computes the cylindrical Bessel function of the first kind of nu and x.
[in] | nu | The order of the function |
[in] | x | The argument to the function, a floating-point or integer value |
nan
, a nan
is returned. If nu is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::cyl_bessel_k | ( | float | nu, |
float | x ) |
Computes the irregular modified cylindrical Bessel function (also known as modified Bessel function of the second kind) of nu and x.
[in] | nu | The order of the function |
[in] | x | The argument to the function, a floating-point or integer value |
nan
, a nan
is returned. If nu is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::cyl_neumann | ( | float | nu, |
float | x ) |
Computes the cylindrical Neumann function ( also known as Bessel function of the second kind or Weber function) of nu and x.
[in] | nu | The order of the function |
[in] | x | The argument to the function, a floating-point or integer value |
nan
, a nan
is returned. If nu is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::ellint_1 | ( | float | k, |
float | phi ) |
Computes the incomplete elliptic integral of the first kind of k and phi.
[in] | k | Elliptic modulus or eccentricity as a floating-point value |
[in] | phi | Jacobi amplitude as a floating-point value given in radians |
nan
, nan
is returned. If |k| > 1
, nan
is returned due the domain error float qlibs::ffmath::ellint_2 | ( | float | k, |
float | phi ) |
Computes the incomplete elliptic integral of the second kind of k and phi.
[in] | k | Elliptic modulus or eccentricity as a floating-point value |
[in] | phi | Jacobi amplitude as a floating-point value given in radians |
nan
, nan
is returned. If |k| > 1
, nan
is returned due the domain error float qlibs::ffmath::ellint_3 | ( | float | k, |
float | nu, | ||
float | phi ) |
Computes the incomplete elliptic integral of the third kind of k, nu and phi.
[in] | k | Elliptic modulus or eccentricity as a floating-point value |
[in] | nu | Elliptic characteristic as a floating-point value |
[in] | phi | Jacobi amplitude as a floating-point value given in radians |
nan
, nan
is returned. If |k| > 1
, nan
is returned due the domain error float qlibs::ffmath::erf | ( | float | x | ) |
Computes the error function of x.
[in] | x | The floating point value |
float qlibs::ffmath::erfc | ( | float | x | ) |
Computes the complementary error function of x.
[in] | x | The floating point value |
float qlibs::ffmath::exp | ( | float | x | ) |
Computes the e ( Euler's number, 2.7182818
) raised to the given power x.
[in] | x | The floating point value |
e^(x)
is returned. If the range validation fails due to overflow, +inf
is returned. float qlibs::ffmath::exp10 | ( | float | x | ) |
Computes the value of 10 raised to the power of x.
[in] | x | The floating point value |
10^(x)
is returned. If the range validation fails due to overflow, ±inf
or nan
is returned. float qlibs::ffmath::exp2 | ( | float | x | ) |
Computes 2 raised to the given power x.
[in] | x | The floating point value |
2^x
is returned. If the range validation fails due to overflow, inf
is returned. float qlibs::ffmath::expint | ( | float | num | ) |
Computes the Exponential integral of num.
[in] | num | A floating-point value |
nan
, nan
is returned. If the argument is ±0
, -inf
is returned. float qlibs::ffmath::expm1 | ( | float | x | ) |
Returns e raised to the given power minus one e^x-1
power x.
[in] | x | The floating point value |
e^(x)-1
is returned. If the range validation fails due to overflow, +inf
is returned. float qlibs::ffmath::factorial | ( | float | x | ) |
Return the factorial of the integer part of x.
14
, result is imprecise because of the limited precision of the 32-bit floating point data-type. With x values greater than 35
, this function overflows. [in] | x | The floating point value |
nan
. If the correct value would cause overflow, factorial() shall return +inf
. float qlibs::ffmath::floor | ( | float | x | ) |
Computes the largest integer value not greater than x.
[in] | x | The floating point value |
float qlibs::ffmath::frac | ( | float | x | ) |
Obtain the fractional part of x.
[in] | x | The floating point value |
float qlibs::ffmath::getInf | ( | void | ) |
Returns positive infinity inf
as a 32-bit floating point number.
+inf
value float qlibs::ffmath::getNan | ( | void | ) |
Returns Not a Number ( NaN ) nan
as a 32-bit floating point number.
nan
value float qlibs::ffmath::hermite | ( | size_t | n, |
float | x ) |
Computes the (physicist's) Hermite polynomials of the degree n and argument x.
[in] | n | The degree of the polynomial |
[in] | x | The argument, a floating-point value |
nan
, nan
is returned. If n>=128
, the behavior is implementation-defined. float qlibs::ffmath::hypot | ( | float | x, |
float | y ) |
Computes the square root of the sum of the squares of x and y, without undue overflow or underflow at intermediate stages of the computation.
[in] | x | The floating point value |
[in] | y | The floating point value |
sqrt(x^2 + y^2)
, is returned. If the range validation fails due to overflow, +inf
is returned. If the range validation fails due to underflow, the correct result (after rounding) is returned.
|
noexcept |
Determines if the point at ( x, y) is inside the circle with radius r located at cx and cy.
[in] | x | Point x-coordinate |
[in] | y | Point y-coordinate |
[in] | cx | X-location of the circle |
[in] | cy | Y-location of the circle |
[in] | r | Radio of the circle |
true
when the given point is inside the circle
|
noexcept |
Determines if the point at ( x, y ) is inside the polygon given by the set of points on px and py.
[in] | x | Point x-coordinate |
[in] | y | Point y-coordinate |
[in] | px | x-coordinate points of the polygon |
[in] | py | y-coordinate points of the polygon |
[in] | p | Number of points that represent the polygon |
true
when the given point is inside the polygon
|
noexcept |
Determines if the value pointed by x falls within a range specified by the upper limit and lower limit inputs and coerces the value to fall within the range.
[in,out] | x | Input |
[in] | lowerL | Lower limit. |
[in] | upperL | Upper limit. |
true
when the value falls within the specified range, otherwise false
|
noexcept |
Determines if the parameters given as floating-point values are approximately equal.
[in] | a | Input to be compared. |
[in] | b | Input to be compared. |
[in] | tol | Tolerance |
true
when both values are approximately equal.
|
inline |
Determines if the given floating point number x has finite value i.e. it is normal, subnormal or zero, but not infinite or NaN.
[in] | x | The number you want to test. |
true
if x has a finite value, false
otherwise
|
inline |
Determine if x is Infinity.
[in] | x | The number you want to test. |
true
if the value of x is ±Infinity, otherwise returns false
.
|
inline |
Determine if x is Not-A-Number NaN.
[in] | x | The number you want to test. |
true
if the value of x is NaN, otherwise returns false
.
|
inline |
Determines if the given floating point number x is normal, i.e. is neither zero, subnormal, infinite, or NaN.
[in] | x | The number you want to test. |
true
if x has a normal value, false
otherwise float qlibs::ffmath::laguerre | ( | size_t | n, |
float | x ) |
Computes the non-associated Laguerre polynomials of the degree n, and argument x.
[in] | n | The degree of the polynomial, an unsigned integer value |
[in] | x | The argument, a floating-point or integer value |
nan
, a nan
is returned. If x is negative, nan
is returned. If n is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::ldexp | ( | float | x, |
int32_t | pw2 ) |
Multiplies a floating point value x by the number 2 raised to the pw2 power.
[in] | x | The floating point value |
[in] | pw2 | Integer value |
x×2^pwd
is returned. If the range validation fails due to overflow, ±inf
is returned. If the range validation fails due to underflow, the correct result (after rounding) is returned. float qlibs::ffmath::legendre | ( | size_t | n, |
float | x ) |
Computes the unassociated Legendre polynomials of the degree n, and argument x.
[in] | n | The degree of the polynomial, an unsigned integer value |
[in] | x | The argument, a floating-point or integer value |
nan
, a nan
is returned. The function is not required to be defined for |x| > 1
. If n is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::lerp | ( | float | a, |
float | b, | ||
float | t ) |
Computes the linear interpolation between a and b, if the parameter t is inside [0, 1] (the linear extrapolation otherwise), i.e. the result of a+t*(b-a)
with accounting for floating-point calculation imprecision.
a | A floating point value |
b | A floating point value |
t | A floating point value |
a+t*(b-a)
. When both a and b are finite, the following properties are guaranteed: If t==0
, the result is equal to a. If t==1
, the result is equal to b. If t>=0
and t<=1
, the result is finite. If t is finite and a==b
, the result is equal to a. If t is finite or (a-b)!=0
with t infinity, the result is not nan
. Let CMP(x,y)
be 1
if x>y
, -1
if x<y
, and 0
otherwise. For any t1
and t2
, the product of: CMP(lerp(a,b,t2)
, lerp(a,b,t1)
, CMP(t2,t1)
, and CMP(b,a)
is non-negative. (That is, lerp() is monotonic.). float qlibs::ffmath::lgamma | ( | float | x | ) |
Computes the natural logarithm of the absolute value of the gamma function of x.
[in] | x | The floating point value |
+inf
. If the correct value would cause overflow, lgamma() shall return ±inf
having the same sign as the correct value. If x is nan
, a nan
shall be returned. If x is 1
or 2
, +0
shall be returned. If x is ±inf
, +inf
shall be returned. float qlibs::ffmath::log | ( | float | x | ) |
Computes the natural (base e) logarithm of x.
[in] | x | The floating point value |
ln(x)
is returned. If the domain validation fails, a nan
value is returned. If the pole validation fails, -inf
is returned. float qlibs::ffmath::log10 | ( | float | x | ) |
Computes the common (base-10) logarithm of x.
[in] | x | The floating point value |
log_10(x)
is returned. If the domain validation fails, a nan
value is returned. If the pole validation fails, -inf
is returned. float qlibs::ffmath::log1p | ( | float | x | ) |
Computes the natural (base e) logarithm of 1 plus the given number x ln
(1+x) .
[in] | x | The floating point value |
ln
(1+x) is returned. If the domain validation fails, a nan
value is returned. If the pole validation fails, -inf
is returned. float qlibs::ffmath::log2 | ( | float | x | ) |
Computes the base 2 logarithm of x.
[in] | x | The floating point value |
log_2(x)
is returned. If the domain validation fails, a nan
value is returned. If the pole validation fails, -inf
is returned.
|
noexcept |
Scales the given input x in value range given by xMin and xMax to value range specified by the yMin and yMax.
[in] | x | Input |
[in] | xMin | Input minimum value for range |
[in] | xMax | Input maximum value for range |
[in] | yMin | Output minimum value for range |
[in] | yMax | Output maximum value for range |
T qlibs::ffmath::Max | ( | const T & | first, |
const Args &... | args ) |
Finds the maximum value among the provided arguments.
T | The type of the arguments. Must support comparison using `>`. |
Args | A parameter pack representing additional arguments of type `T`. |
first | The first argument in the list. |
args | Additional arguments to compare. |
float qlibs::ffmath::midpoint | ( | float | a, |
float | b ) |
Computes the midpoint of the floating-points a and b.
a | A floating point value |
b | A floating point value |
T qlibs::ffmath::Min | ( | const T & | first, |
const Args &... | args ) |
Finds the minimum value among the provided arguments.
T | The type of the arguments. Must support comparison using `<`. |
Args | A parameter pack representing additional arguments of type `T`. |
first | The first argument in the list. |
args | Additional arguments to compare. |
float qlibs::ffmath::mod | ( | float | x, |
float | y ) |
Computes the floating point remainder after division of x by y, where x is the dividend and y is the divisor. This function is often called the modulo operation, which can be expressed as b=a-m*floor(a/m)
. This function follows the convention that mod(x,0)
returns x.
mod(x,0)
returns x
, whereas the rem function follows the convention that rem(x,0)
returns nan
. [in] | x | The floating point value |
[in] | y | The floating point value |
x/y
. If the domain validation fails, a nan
value is returned. float qlibs::ffmath::nextAfter | ( | float | x, |
float | y ) |
Returns the next representable value of x in the direction of y. If x equals to y, y is returned.
[in] | x | The floating point value |
[in] | y | The floating point value |
±inf
is returned (with the same sign as x). If the range validation fails due to underflow, the correct result is returned.
|
noexcept |
Normalize the given input x in value range given by xMin and xMax to value range between 0 and 1.
[in] | x | Input |
[in] | xMin | Input minimum value for range |
[in] | xMax | Input maximum value for range |
float qlibs::ffmath::pow | ( | float | b, |
float | e ) |
Computes the value of b raised to the power e.
[in] | b | Base as floating point value |
[in] | e | Exponent as floating point value |
b^e
is returned. If the domain validation fails, a nan
value is returned. If the pole or range validation fails due to overflow, ±inf
is returned. float qlibs::ffmath::rCbrt | ( | float | x | ) |
Computes the reciprocal cubic-root of x denoted as 1/cbrt(x)
[in] | x | The floating point value |
nan
is returned float qlibs::ffmath::recip | ( | float | x | ) |
Computes the multiplicative inverse or reciprocal for the value x, denoted by 1/x
or x^(−1)
[in] | x | The floating point value |
float qlibs::ffmath::rem | ( | float | x, |
float | y ) |
Computes the floating point remainder after division of x by y, where x is the dividend and y is the divisor. This function is often called the remainder operation, which can be expressed as r=a-(b*trunc(a/b))
. This function follows the convention that rem(x,0)
is nan
.
mod(x,0)
returns x
, whereas the rem function follows the convention that rem(x,0)
returns nan
. [in] | x | The floating point value |
[in] | y | The floating point value |
x/y
. If the domain validation fails, a nan
value is returned. float qlibs::ffmath::rexp | ( | float | x, |
int32_t * | pw2 ) |
Decomposes given floating point value x into a normalized fraction and an integral power of two.
[in] | x | The floating point value |
[in] | pw2 | Pointer to integer value to store the exponent to |
(-1;-0.5]
, [0.5; 1)
and stores an integer value in pw2 such that y×2^(pw2) = x
. If the value to be stored in pw2 is outside the range of an int
, the behavior is unspecified. If x is not a floating-point number, the behavior is unspecified. float qlibs::ffmath::riemann_zeta | ( | float | s | ) |
Computes the Riemann zeta function of s.
[in] | s | A floating-point value |
nan
, nan
is returned. float qlibs::ffmath::rounding | ( | float | x | ) |
Computes the nearest integer value to x (in floating-point format), rounding halfway cases away from zero.
[in] | x | The floating point value |
float qlibs::ffmath::rSqrt | ( | float | x | ) |
Computes the reciprocal square-root of x denoted as 1/sqrt(x)
[in] | x | The floating point value |
nan
is returned float qlibs::ffmath::sign | ( | float | x | ) |
Computes the sign function ( signum function).
[in] | x | The floating point value |
float qlibs::ffmath::sin | ( | float | x | ) |
Computes the sine of x (measured in radians).
[in] | x | The floating point value |
sin(x)
in the range [-1 ; +1]
, is returned. If the domain validation fails, a nan
value is returned. float qlibs::ffmath::sinh | ( | float | x | ) |
Computes hyperbolic sine of x.
[in] | x | The floating point value |
sinh(x)
is returned. If the range validation fails, a ±inf
is value is returned. float qlibs::ffmath::sph_bessel | ( | size_t | n, |
float | x ) |
Computes the spherical Bessel function of the first kind n, and x.
[in] | n | The order of the function |
[in] | x | The argument to the function, a floating-point or integer value |
nan
, a nan
is returned. If n is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::sph_legendre | ( | size_t | l, |
size_t | m, | ||
float | theta ) |
1-3) Computes the spherical associated Legendre function of degree l, order m, and polar angle theta
[in] | l | The degree |
[in] | m | The order |
[in] | theta | Polar angle, measured in radians |
nan
, a nan
is returned. If l is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::sph_neumann | ( | size_t | n, |
float | x ) |
Computes the spherical Bessel function of the second kind also known as the spherical Neumann function of n and x.
[in] | n | The order of the function |
[in] | x | The argument to the function, a floating-point or integer value |
nan
, a nan
is returned. If n is greater or equal than 128
, the behavior is implementation-defined. float qlibs::ffmath::sqrt | ( | float | x | ) |
Computes the square-root of x.
[in] | x | The floating point value |
nan
is returned float qlibs::ffmath::tan | ( | float | x | ) |
Computes the tangent of x (measured in radians).
[in] | x | The floating point value |
tan(x)
is returned. If the domain validation fails, a nan
value is returned. float qlibs::ffmath::tanh | ( | float | x | ) |
Computes hyperbolic tangent of x.
[in] | x | The floating point value |
tanh(x)
is returned. float qlibs::ffmath::tgamma | ( | float | x | ) |
Computes the gamma function of x.
[in] | x | The floating point value |
Gamma(x)
. If x is a negative integer, a inf
value shall be returned. If the correct value would cause overflow, tgamma() shall return ±Inf
, with the same sign as the correct value of the function. If x is nan
, a nan
shall be returned. If x is +inf
, x shall be returned. If x is ±0
, tgamma() shall return ±Inf
. If x is -inf
, a nan
value shall be returned. For IEEE Std 754-1985 float, overflow happens when 0 < x < 1/FLT_MAX
, and 171.7 < x
. float qlibs::ffmath::trunc | ( | float | x | ) |
Computes the nearest integer not greater in magnitude than x.
[in] | x | The floating point value |
float qlibs::ffmath::wrapTo180 | ( | float | x | ) |
Wraps angle x, in degrees, to the interval [–180, 180]
such that 180
maps to 180
and –180
maps to –180
. In general, odd, positive multiples of 180
map to 180
and odd, negative multiples of 180
map to –180
.
x | The angle in degrees |
[-180, 180]
interval float qlibs::ffmath::wrapTo2Pi | ( | float | x | ) |
Wraps angle x, in radians, to the interval [0, 2*pi]
such that 0
maps to 0
and 2*pi
and 2*pi
maps to 2*pi
. In general, positive multiples of 2*pi
map to 2*pi
and negative multiples of 2*pi
map to 0
.
x | The angle in radians |
[0, 2*pi]
interval float qlibs::ffmath::wrapTo360 | ( | float | x | ) |
Wraps angle x, in degrees, to the interval [0, 360]
such that 0
maps to 0
and 360
maps to 360
. In general, positive multiples of 360
map to 360
and negative multiples of 360
map to zero.
x | The angle in degrees |
[0, 360]
interval float qlibs::ffmath::wrapToPi | ( | float | x | ) |
Wraps angle x, in radians, to the interval [−pi, pi]
such that pi
maps to pi
and −pi
maps to −pi
. In general, odd, positive multiples of pi
map to pi
and odd, negative multiples of pi
map to −pi
.
x | The angle in radians |
[-pi, pi]
interval
|
constexpr |
The inverse of π ( 1/π ) given as a single-precision floating-point number.
|
constexpr |
The inverse of the square root of π ( 1/√π ) given as a single-precision floating-point number.
|
constexpr |
Twice the inverse of π ( 2/π ) given as a single-precision floating-point number.
|
constexpr |
Twice the inverse of the square root of π ( 1/√π ) given as a single-precision floating-point number.
|
constexpr |
Twice circumference of a circle with diameter 1, ( 2π ) given as a single-precision floating-point number.
|
constexpr |
The base of natural logarithms ( e ) given as a single-precision floating-point number.
|
constexpr |
Constant Euler-Mascheroni given as a single-precision floating-point number.
|
constexpr |
The natural logarithm of 10 ( ln 10 ) given as a single-precision floating-point number.
|
constexpr |
The natural logarithm of 2 ( ln 2 ) given as a single-precision floating-point number.
|
constexpr |
The natural logarithm of π ( ln(π) ) given as a single-precision floating-point number.
|
constexpr |
The natural logarithm of the square root of 2π given as a single-precision floating-point number.
|
constexpr |
The base 10 logarithm of 2 ( log_10 2 ) given as a single-precision floating-point number.
|
constexpr |
The base 10 logarithm of e ( log_10 e ) given as a single-precision floating-point number.
|
constexpr |
The base 2 logarithm of e ( log_2 e ) given as a single-precision floating-point number.
|
constexpr |
The golden ratio, (1+√5)/2 given as a single-precision floating-point number.
|
constexpr |
The circumference of a circle with diameter 1, ( π ) given as a single-precision floating-point number.
|
constexpr |
Half of π ( π/2 ) given as a single-precision floating-point number.
|
constexpr |
A quarter of π ( π/4 ) given as a single-precision floating-point number.
|
constexpr |
Radian, value of ( 180/π ) given as a single-precision floating-point number.
|
constexpr |
The inverse of square root of 2 ( 1/√2 ) given as a single-precision floating-point number.
|
constexpr |
The inverse of square root of 3 ( 1/√3 ) given as a single-precision floating-point number.
|
constexpr |
The square root of 2 ( √2 ) given as a single-precision floating-point number.
|
constexpr |
The square root of 3 ( √3 ) given as a single-precision floating-point number.