Imt.Base C++ API V4.1.1.0
Loading...
Searching...
No Matches
imt::base::core::math::Maths Class Referencefinal

Mathematical utility functions. More...

#include <Imt.Base.Core.Math/inc/Imt.Base.Core.Math/Maths.h>

Inheritance diagram for imt::base::core::math::Maths:
imt::base::core::platform::StaticClass

Static Public Member Functions

template<typename Type >
static bool areEqualNumbers (Type const left, Type const right)
 Compares two numbers.
 
template<typename Type >
static bool areEqualFloats (Type const left, Type const right)
 Compares two floating point numbers.
 
template<typename Type >
static bool areEqualArrayFloats (Type const *left, Type const *right, size_t size)
 Compares two floating point arrays.
 
template<typename Type >
static Type sqrt (Type const sqVal)
 Find square root of a value.
 
template<typename Type >
static Type nsqrt (Type const sqVal, Type n)
 Find n-th root of a value.
 
template<typename Type >
static Type nsqrt (Type const sqVal, int32_t n)
 
template<typename Type >
static Type exp (Type const value)
 Computes e (Euler's number, 2.7182818...) raised to the given power arg.
 
template<typename Type >
static Type ln (Type const arg)
 Computes the natural (base e) logarithm of arg.
 
template<typename Type >
static Type log10 (Type const arg)
 Computes the common (base-10) logarithm of n.
 
template<typename Type >
static Type pow (Type const base, int32_t const exp)
 Computes the value of base (m) raised to the power exponent (n)
 
static float64_t pow10 (int32_t const exp)
 Computes the value of 10 raised to the power exp.
 
template<typename Type >
static Type fabs (Type const value)
 Find absolute value of a given input.
 
template<typename Type >
static Type abs (Type const value)
 Find absolute value of a given input.
 
template<typename Type >
static Type sin (Type const value)
 Computes the sine of arg (measured in radians)
 
template<typename Type >
static Type cos (Type const value)
 Computes the cosine of arg (measured in radians)
 
template<typename Type >
static Type tan (Type const value)
 Computes the tangens of arg (measured in radians)
 
template<typename Type >
static Type arcos (Type const value)
 Computes the arccos of arg.
 
template<typename Type >
static Type arsin (Type const value)
 Computes the arsin of arg.
 
template<typename Type >
static Type artan (Type const value)
 Computes the arctan of arg.
 
template<typename Type >
static Type artan2 (Type const y, Type const x)
 Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.
 
template<typename Type >
static Type cosh (Type const value)
 Computes the cosh of arg (measured in radians)
 
template<typename Type >
static Type sinh (Type const value)
 Computes the sinh of arg (measured in radians)
 
template<typename Type >
static Type tanh (Type const value)
 Computes the tanh of arg (measured in radians)
 
template<typename Type >
static Type arsinh (Type const value)
 Computes the arsinh of arg (measured in radians)
 
template<typename Type >
static Type arcosh (Type const value)
 Computes the acosh of arg (measured in radians)
 
template<typename Type >
static Type artanh (Type const value)
 Computes the inverse hyperbolic tangent of arg.
 
template<typename Type >
static Type copysign (Type const &x, Type const &y)
 Returns a value with the magnitude of x and the sign of y.
 
template<typename Type >
static Type erf (Type const &x)
 Compute error function.
 
template<typename Type >
static Type erfc (Type const &x)
 Compute complementary error function.
 
template<typename Type >
static Type expm1 (Type const &x)
 Compute exponential minus one.
 
template<typename Type >
static Type fdim (Type const &x, Type const &y)
 Positive difference.
 
template<typename Type >
static Type floor (Type const &x)
 Round down value.
 
template<typename Type >
static Type fmod (Type const &numer, Type const &denom)
 Compute remainder of division.
 
template<typename Type >
static Type frexp (Type const &x, int32_t *exp)
 Get significand and exponent.
 
template<typename Type >
static Type hypot (Type const &x, Type const &y)
 Compute hypotenuse.
 
template<typename Type >
static int32_t ilogb (Type const &x)
 Integer binary logarithm.
 
template<typename Type >
static bool isinf (Type const &x)
 Is infinity.
 
template<typename Type >
static bool isnan (Type const &x)
 Is Not-A-Number.
 
static double nan (char const *tagp)
 Generate quiet NaN.
 
static float nanf (char const *tagp)
 Generate quiet NaN.
 
template<typename Type >
static bool ldexp (Type const &x, int32_t exp)
 Generate value from significand and exponent.
 
template<typename Type >
static Type log1p (Type const &x)
 Compute logarithm plus one.
 
template<typename Type >
static Type log2 (Type const &x)
 Compute binary logarithm.
 
template<typename Type >
static Type logb (Type const &x)
 Compute floating-point base logarithm.
 
template<typename Type >
static Type modf (Type const &x, Type *intpart)
 Break into fractional and integral parts.
 
template<typename Type >
static Type modf (Type const &x, int8_t const *tagp)
 Generate quiet NaN.
 
template<typename Type >
static Type nextafter (Type const &x, Type const &y)
 Next representable value.
 
template<typename Type >
static Type remainder (Type const &numer, Type const &denom)
 Compute remainder (IEC 60559)
 
template<typename Type >
static Type remquo (Type const &numer, Type const &denom, int32_t *quot)
 Compute remainder and quotient.
 
template<typename Type >
static Type rint (Type const &x)
 Round to integral value.
 
template<typename Type >
static Type scalbln (Type const &x, long int n)
 Scale significand using floating-point base exponent (long)
 
template<typename Type >
static Type scalbn (Type const &x, int32_t n)
 Scale significand using floating-point base exponent.
 
template<typename Type >
static Type trunc (Type const &x)
 Truncate value.
 

Detailed Description

Mathematical utility functions.

Pure static class.

Definition at line 95 of file Maths.h.

Member Function Documentation

◆ abs()

template<typename Type >
static Type imt::base::core::math::Maths::abs ( Type const  value)
inlinestatic

Find absolute value of a given input.

Parameters
valueThe value to which absolute value has to be calculated.
Returns
Absolute of the input value.

Definition at line 230 of file Maths.h.

◆ arcos()

template<typename Type >
static Type imt::base::core::math::Maths::arcos ( Type const  value)
inlinestatic

Computes the arccos of arg.

Parameters
valuethe value to compute
Returns
computes arccos(value) in the range 0 to +pi radians

Definition at line 270 of file Maths.h.

◆ arcosh()

template<typename Type >
static Type imt::base::core::math::Maths::arcosh ( Type const  value)
inlinestatic

Computes the acosh of arg (measured in radians)

Parameters
valuerepresenting in radians
Returns
computes cosh^{-1}(value)

Definition at line 351 of file Maths.h.

◆ areEqualArrayFloats()

template<typename Type >
static bool imt::base::core::math::Maths::areEqualArrayFloats ( Type const *  left,
Type const *  right,
size_t  size 
)
inlinestatic

Compares two floating point arrays.

Parameters
leftPointer to first array.
rightPointer to second array.
sizeNumber of elements of each array.
Returns
True if arrays are equal.

Definition at line 129 of file Maths.h.

◆ areEqualFloats()

template<typename Type >
static bool imt::base::core::math::Maths::areEqualFloats ( Type const  left,
Type const  right 
)
inlinestatic

Compares two floating point numbers.

Parameters
leftFirst number.
rightSecond number.
Returns
True if numbers are equal.

Definition at line 117 of file Maths.h.

◆ areEqualNumbers()

template<typename Type >
static bool imt::base::core::math::Maths::areEqualNumbers ( Type const  left,
Type const  right 
)
inlinestatic

Compares two numbers.

Parameters
leftFirst number.
rightSecond number.
Returns
True if numbers are equal.

Definition at line 106 of file Maths.h.

◆ arsin()

template<typename Type >
static Type imt::base::core::math::Maths::arsin ( Type const  value)
inlinestatic

Computes the arsin of arg.

Parameters
valuethe value to compute
Returns
computes arsin(value) in the range -pi/2 to +pi/2 radians

Definition at line 280 of file Maths.h.

◆ arsinh()

template<typename Type >
static Type imt::base::core::math::Maths::arsinh ( Type const  value)
inlinestatic

Computes the arsinh of arg (measured in radians)

Parameters
valuerepresenting in radians
Returns
computes sinh^{-1}(value)

Definition at line 341 of file Maths.h.

◆ artan()

template<typename Type >
static Type imt::base::core::math::Maths::artan ( Type const  value)
inlinestatic

Computes the arctan of arg.

Parameters
valuethe value
Returns
computes arctan(value) in the range -pi/2 to +pi/2 radians

Definition at line 290 of file Maths.h.

◆ artan2()

template<typename Type >
static Type imt::base::core::math::Maths::artan2 ( Type const  y,
Type const  x 
)
inlinestatic

Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.

Parameters
xvalue x
yvalue y
Returns
computes y/x (arctan(y/x) in the range -pi to +pi radians

Definition at line 301 of file Maths.h.

◆ artanh()

template<typename Type >
static Type imt::base::core::math::Maths::artanh ( Type const  value)
inlinestatic

Computes the inverse hyperbolic tangent of arg.

Parameters
valuethe value
Returns
computes tanh^{-1}(value)

Definition at line 361 of file Maths.h.

◆ copysign()

template<typename Type >
static Type imt::base::core::math::Maths::copysign ( Type const &  x,
Type const &  y 
)
inlinestatic

Returns a value with the magnitude of x and the sign of y.

Parameters
xValue with the magnitude of the resulting value.
yValue with the sign of the resulting value.
Returns
The value with a magnitude of x and the sign of y.

Definition at line 372 of file Maths.h.

◆ cos()

template<typename Type >
static Type imt::base::core::math::Maths::cos ( Type const  value)
inlinestatic

Computes the cosine of arg (measured in radians)

Parameters
valuerepresenting in radians
Returns
computes cos(value)

Definition at line 250 of file Maths.h.

◆ cosh()

template<typename Type >
static Type imt::base::core::math::Maths::cosh ( Type const  value)
inlinestatic

Computes the cosh of arg (measured in radians)

Parameters
valuerepresenting in radians
Returns
computes cosh(value)

Definition at line 311 of file Maths.h.

◆ erf()

template<typename Type >
static Type imt::base::core::math::Maths::erf ( Type const &  x)
inlinestatic

Compute error function.

Parameters
xParameter for the error function.
Returns
Error function value for x.

Definition at line 382 of file Maths.h.

◆ erfc()

template<typename Type >
static Type imt::base::core::math::Maths::erfc ( Type const &  x)
inlinestatic

Compute complementary error function.

Parameters
xParameter for the complementary error function.
Returns
Complementary error function value for x.

Definition at line 392 of file Maths.h.

◆ exp()

template<typename Type >
static Type imt::base::core::math::Maths::exp ( Type const  value)
inlinestatic

Computes e (Euler's number, 2.7182818...) raised to the given power arg.

Parameters
valuethe exponent n
Returns
computes power of e^n

Definition at line 168 of file Maths.h.

◆ expm1()

template<typename Type >
static Type imt::base::core::math::Maths::expm1 ( Type const &  x)
inlinestatic

Compute exponential minus one.

Returns e raised to the power x minus one: ex-1. For small magnitude values of x, expm1 may be more accurate than exp(x)-1.

Parameters
xValue of the exponent.
Returns
e raised to the power of x, minus one. If the magnitude of the result is too large to be represented by a value of the return type, the function returns HUGE_VAL (or HUGE_VALF or HUGE_VALL) with the proper sign.

Definition at line 408 of file Maths.h.

◆ fabs()

template<typename Type >
static Type imt::base::core::math::Maths::fabs ( Type const  value)
inlinestatic

Find absolute value of a given input.

Parameters
valueThe value to which absolute value has to be calculated.
Returns
Absolute of the input value.

Definition at line 220 of file Maths.h.

◆ fdim()

template<typename Type >
static Type imt::base::core::math::Maths::fdim ( Type const &  x,
Type const &  y 
)
inlinestatic

Positive difference.

Returns the positive difference between x and y. The function returns x-y if x>y, and zero otherwise.

Parameters
xValues whose difference is calculated.
yValues whose difference is calculated.
Returns
The positive difference between x and y.

Definition at line 422 of file Maths.h.

◆ floor()

template<typename Type >
static Type imt::base::core::math::Maths::floor ( Type const &  x)
inlinestatic

Round down value.

Rounds x downward, returning the largest integral value that is not greater than x.

Parameters
xValue to round down.
Returns
The positive difference between x and y.

Definition at line 435 of file Maths.h.

◆ fmod()

template<typename Type >
static Type imt::base::core::math::Maths::fmod ( Type const &  numer,
Type const &  denom 
)
inlinestatic

Compute remainder of division.

Returns the floating-point remainder of numer/denom (rounded towards zero):

fmod = numer - tquot * denom

Parameters
numerValue of the quotient numerator.
denomValue of the quotient denominator.
Returns
The remainder of dividing the arguments. If denom is zero, the function may either return zero

Definition at line 453 of file Maths.h.

◆ frexp()

template<typename Type >
static Type imt::base::core::math::Maths::frexp ( Type const &  x,
int32_t exp 
)
inlinestatic

Get significand and exponent.

Breaks the floating point number x into its binary significand (a floating point with an absolute value between 0.5(included) and 1.0(excluded)) and an integral exponent for 2, such that:

x = significand * 2 exponent The exponent is stored in the location pointed by exp, and the significand is the value returned by the function.

If x is zero, both parts (significand and exponent) are zero. If x is negative, the significand returned by this function is negative.

Parameters
xValue to be decomposed.
expPointer to an int where the value of the exponent is stored.
Returns
The binary significand of x. This value is the floating point value whose absolute value lays in the interval [0.5,1) which, once multiplied by 2 raised to the power of exp, yields x.

Definition at line 476 of file Maths.h.

◆ hypot()

template<typename Type >
static Type imt::base::core::math::Maths::hypot ( Type const &  x,
Type const &  y 
)
inlinestatic

Compute hypotenuse.

Returns the hypotenuse of a right-angled triangle whose legs are x and y.

The function returns what would be the square root of the sum of the squares of x and y (as per the Pythagorean theorem), but without incurring in undue overflow or underflow of intermediate values.

Parameters
xFloating point values corresponding to the legs of a right-angled triangle for which the hypotenuse is computed.
yFloating point values corresponding to the legs of a right-angled triangle for which the hypotenuse is computed.
Returns
The square root of (x2+y2). If the magnitude of the result is too large to be represented by a value of the return type, the function may return HUGE_VAL (or HUGE_VALF or HUGE_VALL) with the proper sign.

Definition at line 498 of file Maths.h.

◆ ilogb()

template<typename Type >
static int32_t imt::base::core::math::Maths::ilogb ( Type const &  x)
inlinestatic

Integer binary logarithm.

Returns the integral part of the logarithm of |x|, using FLT_RADIX as base for the logarithm.

This is the exponent used internally by the machine to express the floating-point value x, when it uses a significand between 1.0 and FLT_RADIX, so that, for a positive x:

x = significand * FLT_RADIX exponent

Generally, FLT_RADIX is 2, and the value returned by this function is one less than the exponent obtained with frexp (because of the different significand normalization as [1.0,2.0) instead of [0.5,1.0)).

Parameters
xValue whose ilogb is returned.
Returns
If x is normal, the base-FLT_RADIX logarithm of x. If x is subnormal, the value returned is the one corresponding to the normalized representation (negative exponent). If x is zero, it returns FP_LOGB0 (a special value, only returned by this function, defined in math.h). If x is infinite, it returns INT_MAX. If x is NaN, it returns FP_ILOGBNAN (a special value, only returned by this function, defined in math.h).

Definition at line 529 of file Maths.h.

◆ isinf()

template<typename Type >
static bool imt::base::core::math::Maths::isinf ( Type const &  x)
inlinestatic

Is infinity.

Returns whether x is an infinity value (either positive infinity or negative infinity).

Parameters
xA floating-point value.
Returns
A non-zero value (true) if x is an infinity; and zero (false) otherwise.

Definition at line 544 of file Maths.h.

◆ isnan()

template<typename Type >
static bool imt::base::core::math::Maths::isnan ( Type const &  x)
inlinestatic

Is Not-A-Number.

Returns whether x is a NaN (Not-A-Number) value.

The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.

Parameters
xA floating-point value.
Returns
A non-zero value (true) if x is a NaN value; and zero (false) otherwise.

Definition at line 562 of file Maths.h.

◆ ldexp()

template<typename Type >
static bool imt::base::core::math::Maths::ldexp ( Type const &  x,
int32_t  exp 
)
inlinestatic

Generate value from significand and exponent.

Returns the result of multiplying x (the significand) by 2 raised to the power of exp (the exponent).

lexpr(x,exp) = x * 2 exp

Parameters
xFloating point value representing the significand.
expValue of the exponent.
Returns
The function returns:

x * 2 exp

If the magnitude of the result is too large to be represented by a value of the return type, the function returns HUGE_VAL (or HUGE_VALF or HUGE_VALL) with the proper sign.

Definition at line 639 of file Maths.h.

◆ ln()

template<typename Type >
static Type imt::base::core::math::Maths::ln ( Type const  arg)
inlinestatic

Computes the natural (base e) logarithm of arg.

Parameters
argthe value
Returns
computes ln(value)

Definition at line 179 of file Maths.h.

◆ log10()

template<typename Type >
static Type imt::base::core::math::Maths::log10 ( Type const  arg)
inlinestatic

Computes the common (base-10) logarithm of n.

Parameters
argthe value n
Returns
computes log_10(n)

Definition at line 189 of file Maths.h.

◆ log1p()

template<typename Type >
static Type imt::base::core::math::Maths::log1p ( Type const &  x)
inlinestatic

Compute logarithm plus one.

Returns the natural logarithm of one plus x.

For small magnitude values of x, logp1 may be more accurate than log(1+x).

Parameters
xValue whose logarithm is calculated.
Returns
The natural logarithm of (1+x).

Definition at line 654 of file Maths.h.

◆ log2()

template<typename Type >
static Type imt::base::core::math::Maths::log2 ( Type const &  x)
inlinestatic

Compute binary logarithm.

Returns the binary (base-2) logarithm of x.

Parameters
xValue whose logarithm is calculated.
Returns
The binary logarithm of x: log2x.

Definition at line 667 of file Maths.h.

◆ logb()

template<typename Type >
static Type imt::base::core::math::Maths::logb ( Type const &  x)
inlinestatic

Compute floating-point base logarithm.

Returns the logarithm of |x|, using FLT_RADIX as base for the logarithm.

On most platforms, FLT_RADIX is 2, and thus this function is equivalent to log2 for positive values.

Parameters
xValue whose logarithm is calculated.
Returns
The base-FLT_RADIX logarithm of x.

Definition at line 683 of file Maths.h.

◆ modf() [1/2]

template<typename Type >
static Type imt::base::core::math::Maths::modf ( Type const &  x,
int8_t const *  tagp 
)
inlinestatic

Generate quiet NaN.

Returns a quiet NaN (Not-A-Number) value of type double.

The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.

The argument can be used by library implementations to distinguish different NaN values in a implementation-specific manner.

Similarly, nanf and nanl return NaN values of type float and long double, respectively.

Parameters
xFloating point value to break into parts.
tagpAn implementation-specific C-string. If this is an empty string (""), the function returns a generic NaN value (the same as returned by passing "NAN" to strtod).
Returns
A quiet NaN value.

Definition at line 729 of file Maths.h.

◆ modf() [2/2]

template<typename Type >
static Type imt::base::core::math::Maths::modf ( Type const &  x,
Type *  intpart 
)
inlinestatic

Break into fractional and integral parts.

Breaks x into an integral and a fractional part.

The integer part is stored in the object pointed by intpart, and the fractional part is returned by the function. Both parts have the same sign as x.

Parameters
xFloating point value to break into parts.
intpartPointer to an object (of the same type as x) where the integral part is stored with the same sign as x.
Returns
The fractional part of x, with the same sign.

Definition at line 702 of file Maths.h.

◆ nan()

static double imt::base::core::math::Maths::nan ( char const *  tagp)
inlinestatic

Generate quiet NaN.

Returns a quiet NaN (Not-A-Number) value of type double.

The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.

The argument can be used by library implementations to distinguish different NaN values in a implementation-specific manner.

Similarly, nanf and nanl return NaN values of type float and long double, respectively.

Parameters
tagpAn implementation-specific C-string. If this is an empty string (""), the function returns a generic NaN value (the same as returned by passing "NAN" to strtod).
Returns
A quiet NaN value.

Definition at line 589 of file Maths.h.

◆ nanf()

static float imt::base::core::math::Maths::nanf ( char const *  tagp)
inlinestatic

Generate quiet NaN.

Returns a quiet NaN (Not-A-Number) value of type float.

The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.

The argument can be used by library implementations to distinguish different NaN values in a implementation-specific manner.

Similarly, nanf and nanl return NaN values of type float and long float, respectively.

Parameters
tagpAn implementation-specific C-string. If this is an empty string (""), the function returns a generic NaN value (the same as returned by passing "NAN" to strtod).
Returns
A quiet NaN value.

Definition at line 616 of file Maths.h.

◆ nextafter()

template<typename Type >
static Type imt::base::core::math::Maths::nextafter ( Type const &  x,
Type const &  y 
)
inlinestatic

Next representable value.

Returns the next representable value after x in the direction of y.

The similar function, nexttoward has the same behavior, but it takes a long double as second argument.

If both parameters compare equal, the function returns y.

Parameters
xBase value
yValue toward which the return value is approximated.
Returns
A quiet NaN value.

Definition at line 748 of file Maths.h.

◆ nsqrt() [1/2]

template<typename Type >
static Type imt::base::core::math::Maths::nsqrt ( Type const  sqVal,
int32_t  n 
)
inlinestatic

Definition at line 158 of file Maths.h.

◆ nsqrt() [2/2]

template<typename Type >
template< typename Type > Type imt::base::core::math::Maths::nsqrt ( Type const  sqVal,
Type  n 
)
inlinestatic

Find n-th root of a value.

Parameters
sqValThe value to which square root has to be calculated.
nThe root type
Returns
n-te root of the input value.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 150 of file Maths.h.

◆ pow()

template<typename Type >
static Type imt::base::core::math::Maths::pow ( Type const  base,
int32_t const  exp 
)
inlinestatic

Computes the value of base (m) raised to the power exponent (n)

Parameters
basethe base m
expthe exponent n
Returns
computes power of m^n

Definition at line 200 of file Maths.h.

◆ pow10()

static float64_t imt::base::core::math::Maths::pow10 ( int32_t const  exp)
inlinestatic

Computes the value of 10 raised to the power exp.

Parameters
expthe exponent n
Returns
computes power of 10^n

Definition at line 209 of file Maths.h.

◆ remainder()

template<typename Type >
static Type imt::base::core::math::Maths::remainder ( Type const &  numer,
Type const &  denom 
)
inlinestatic

Compute remainder (IEC 60559)

Returns the floating-point remainder of numer/denom (rounded to nearest):

remainder = numer - rquot * denom

Where rquot is the result of: numer/denom, rounded toward the nearest integral value (with halfway cases rounded toward the even number).

Parameters
numerValue of the quotient numerator.
denomValue of the quotient denominator.
Returns
The remainder of dividing the arguments. If this remainder is zero, its sign shall be that of numer.

Definition at line 768 of file Maths.h.

◆ remquo()

template<typename Type >
static Type imt::base::core::math::Maths::remquo ( Type const &  numer,
Type const &  denom,
int32_t quot 
)
inlinestatic

Compute remainder and quotient.

Returns the same as remainder, but it additionally stores the quotient internally used to determine its result in the object pointed by quot.

The value pointed by quot contains the congruent modulo with at least 3 bits of the integral quotient numer/denom.

Parameters
numerValue of the quotient numerator.
denomValue of the quotient denominator.
quotPointer to an object where the quotient internally used to determine the remainder is stored as a value of type int.
Returns
The remainder of dividing the arguments. If this remainder is zero, its sign shall be that of x; In this case, the value stored in quot is unspecified.

Definition at line 790 of file Maths.h.

◆ rint()

template<typename Type >
static Type imt::base::core::math::Maths::rint ( Type const &  x)
inlinestatic

Round to integral value.

Rounds x to an integral value, using the rounding direction specified by fegetround.

This function may raise an FE_INEXACT exception if the value returned differs in value from x. See nearbyint for an equivalent function that cannot raise such exception.

Parameters
xValue to round.
Returns
The value of x rounded to a nearby integral (as a floating-point value). If this value differs from x, a FE_INEXACT exception may be raised (depending on the implementation).

Definition at line 811 of file Maths.h.

◆ scalbln()

template<typename Type >
static Type imt::base::core::math::Maths::scalbln ( Type const &  x,
long int  n 
)
inlinestatic

Scale significand using floating-point base exponent (long)

Scales x by FLT_RADIX raised to the power of n, returning the result of computing:

scalbn(x,n) = x * FLT_RADIXn

Presumably, x and n are the components of a floating-point number in the system; In such a case, this function may be optimized to be more efficient than the theoretical operations to compute the value explicitly.

There also exists another version of this function: scalbn, which is identical, except that it takes an int as second argument.

Parameters
xfloating point value
ninteger value
Returns
Returns x * FLT_RADIXn. If the magnitude of the result is too large to be represented by a value of the return type, the function returns HUGE_VAL (or HUGE_VALF or HUGE_VALL) with the proper sign, and an overflow range error may occur (if too small, the function returns zero, and an underflow range error may occur).

Definition at line 841 of file Maths.h.

◆ scalbn()

template<typename Type >
static Type imt::base::core::math::Maths::scalbn ( Type const &  x,
int32_t  n 
)
inlinestatic

Scale significand using floating-point base exponent.

Scales x by FLT_RADIX raised to the power of n, returning the same as::

scalbn(x,n) = x * FLT_RADIXn

Presumably, x and n are the components of a floating-point number in the system; In such a case, this function may be optimized to be more efficient than the theoretical operations to compute the value explicitly.

On most platforms, FLT_RADIX is 2, making this function equivalent to ldexp.

Parameters
xValue representing the significand.
nValue of the exponent.
Returns
Returns x * FLT_RADIXn. If the magnitude of the result is too large to be represented by a value of the return type, the function returns HUGE_VAL (or HUGE_VALF or HUGE_VALL) with the proper sign, and an overflow range error may occur (if too small, the function returns zero, and an underflow range error may occur).

Definition at line 869 of file Maths.h.

◆ sin()

template<typename Type >
static Type imt::base::core::math::Maths::sin ( Type const  value)
inlinestatic

Computes the sine of arg (measured in radians)

Parameters
valuerepresenting in radians
Returns
computes sin(value)

Definition at line 240 of file Maths.h.

◆ sinh()

template<typename Type >
static Type imt::base::core::math::Maths::sinh ( Type const  value)
inlinestatic

Computes the sinh of arg (measured in radians)

Parameters
valuerepresenting in radians
Returns
computes sinh(value)

Definition at line 321 of file Maths.h.

◆ sqrt()

template<typename Type >
static Type imt::base::core::math::Maths::sqrt ( Type const  sqVal)
inlinestatic

Find square root of a value.

Parameters
sqValThe value to which square root has to be calculated.
Returns
Square root of the input value.

Definition at line 139 of file Maths.h.

◆ tan()

template<typename Type >
static Type imt::base::core::math::Maths::tan ( Type const  value)
inlinestatic

Computes the tangens of arg (measured in radians)

Parameters
valuerepresenting in radians
Returns
computes tan(value)

Definition at line 260 of file Maths.h.

◆ tanh()

template<typename Type >
static Type imt::base::core::math::Maths::tanh ( Type const  value)
inlinestatic

Computes the tanh of arg (measured in radians)

Parameters
valuerepresenting in radians
Returns
computes tanh(value)

Definition at line 331 of file Maths.h.

◆ trunc()

template<typename Type >
static Type imt::base::core::math::Maths::trunc ( Type const &  x)
inlinestatic

Truncate value.

Rounds x toward zero, returning the nearest integral value that is not larger in magnitude than x.

Parameters
xValue to truncate.
Returns
The nearest integral value that is not larger in magnitude than x (as a floating-point value).

Definition at line 884 of file Maths.h.


The documentation for this class was generated from the following file: