Linux Assemblycollection of fast libraries

Math libraryMath.h

Math library declares a set of functions to compute common mathematical operations and transformations. They may replace and extend standard math functions from C library, and provide extra operations for specific mathematical algorithms. It is optimized for x86-64 Linux systems and much faster that standard GNU lib C functions. See the benchmarks to compare speed of each function.

Contents

Function list

C function nameFunctionsC++ function nameFunctions
Abs12 functionsAbs12 functions
AbsError4 functionsAbsError4 functions
ArcCos4 functionsArcCos4 functions
ArcCosH4 functionsArcCosH4 functions
ArcSin4 functionsArcSin4 functions
ArcSinH4 functionsArcSinH4 functions
ArcTan4 functionsArcTan4 functions
ArcTan24 functionsArcTan24 functions
ArcTanH4 functionsArcTanH4 functions
BitReverse16 functionsBitReverse16 functions
ByteSwap16 functionsByteSwap16 functions
Cancel8 functionsCancel8 functions
Cath4 functionsCath4 functions
Compare20 functionsCompare20 functions
Cos4 functionsCos4 functions
CosH4 functionsCosH4 functions
Cube12 functionsCube12 functions
Exp4 functionsExp4 functions
Exp104 functionsExp104 functions
Exp10i3 functionsExp10i3 functions
Exp10m14 functionsExp10m14 functions
Exp24 functionsExp24 functions
Exp2i3 functionsExp2i3 functions
Exp2m14 functionsExp2m14 functions
ExpB4 functionsExpB4 functions
ExpBi8 functionsExpBi8 functions
ExpBm14 functionsExpBm14 functions
Expm14 functionsExpm14 functions
Frac4 functionsFrac4 functions
GCD8 functionsGCD8 functions
Hypot2D4 functionsHypot2D4 functions
Hypot3D4 functionsHypot3D4 functions
InverseCube4 functionsInverseCube4 functions
InverseSquare4 functionsInverseSquare4 functions
InverseValue4 functionsInverseValue4 functions
IsFinite2 functionsIsFinite2 functions
IsInfinite2 functionsIsInfinite2 functions
IsNaN2 functionsIsNaN2 functions
IsNormal2 functionsIsNormal2 functions
IsSubnormal2 functionsIsSubnormal2 functions
LCM8 functionsLCM8 functions
Log4 functionsLog4 functions
Log104 functionsLog104 functions
Log10i4 functionsLog10i4 functions
Log10p14 functionsLog10p14 functions
Log24 functionsLog24 functions
Log2i4 functionsLog2i4 functions
Log2p14 functionsLog2p14 functions
Logp14 functionsLogp14 functions
Max18 functionsMax18 functions
MaxAbs11 functionsMaxAbs11 functions
Min18 functionsMin18 functions
MinAbs11 functionsMinAbs11 functions
NegAbs12 functionsNegAbs12 functions
PopCount16 functionsPopCount16 functions
RelError4 functionsRelError4 functions
RotateLeft8 functionsRotateLeft8 functions
RotateRight8 functionsRotateRight8 functions
Round4 functionsRound4 functions
RoundDown4 functionsRoundDown4 functions
RoundInt4 functionsRoundInt4 functions
RoundUp4 functionsRoundUp4 functions
Scale102 functionsScale102 functions
Scale22 functionsScale22 functions
ScanBackward8 functionsScanBackward8 functions
ScanForward8 functionsScanForward8 functions
Sign12 functionsSign12 functions
Sin4 functionsSin4 functions
SinCos4 functionsSinCos4 functions
SinH4 functionsSinH4 functions
Sqr12 functionsSqr12 functions
Sqrt8 functionsSqrt8 functions
Tan4 functionsTan4 functions
TanH4 functionsTanH4 functions
Truncate4 functionsTruncate4 functions
C function nameFunctionsC++ function nameFunctions

Mathematical constants

ConstantDescription
Basic constants
M_EBase of natural logarithm
M_PIPi const
M_FIThe "Golden Ratio"
M_1_FIThe inverse "Golden Ratio"
Logarithmic constants
M_LN_2Natural logarithm of 2
M_LN_10Natural logarithm of 10
M_LOG2_10Binary logarithm of 10
M_LOG2_EBinary logarithm of e
M_LOG10_2Decimal logarithm of 2
M_LOG10_EDecimal logarithm of e
Square root constants
M_SQRT2Square root of 2
M_SQRT1_2Square root of 1/2
Special constants
M_INFInfinity
M_NANNot a Number

Bitwise operations

A bitwise operation operates on one or more bit patterns or binary numerals at the level of their individual bits. It is a fast, primitive action directly supported by the processor, and is used to manipulate values for comparisons and calculations.

Byte swap

C
Unsigned integer types
uint8_t Math_ByteSwap_uint8 (uint8_t value);
uint16_t Math_ByteSwap_uint16 (uint16_t value);
uint32_t Math_ByteSwap_uint32 (uint32_t value);
uint64_t Math_ByteSwap_uint64 (uint64_t value);
uint8v16_t Math_ByteSwap_uint8v16 (uint8v16_t value);
uint16v8_t Math_ByteSwap_uint16v8 (uint16v8_t value);
uint32v4_t Math_ByteSwap_uint32v4 (uint32v4_t value);
uint64v2_t Math_ByteSwap_uint64v2 (uint64v2_t value);

Signed integer types
sint8_t Math_ByteSwap_sint8 (sint8_t value);
sint16_t Math_ByteSwap_sint16 (sint16_t value);
sint32_t Math_ByteSwap_sint32 (sint32_t value);
sint64_t Math_ByteSwap_sint64 (sint64_t value);
sint8v16_t Math_ByteSwap_sint8v16 (sint8v16_t value);
sint16v8_t Math_ByteSwap_sint16v8 (sint16v8_t value);
sint32v4_t Math_ByteSwap_sint32v4 (sint32v4_t value);
sint64v2_t Math_ByteSwap_sint64v2 (sint64v2_t value);
C++
Unsigned integer types
uint8_t Math::ByteSwap (uint8_t value);
uint16_t Math::ByteSwap (uint16_t value);
uint32_t Math::ByteSwap (uint32_t value);
uint64_t Math::ByteSwap (uint64_t value);
uint8v16_t Math::ByteSwap (uint8v16_t value);
uint16v8_t Math::ByteSwap (uint16v8_t value);
uint32v4_t Math::ByteSwap (uint32v4_t value);
uint64v2_t Math::ByteSwap (uint64v2_t value);

Signed integer types
sint8_t Math::ByteSwap (sint8_t value);
sint16_t Math::ByteSwap (sint16_t value);
sint32_t Math::ByteSwap (sint32_t value);
sint64_t Math::ByteSwap (sint64_t value);
sint8v16_t Math::ByteSwap (sint8v16_t value);
sint16v8_t Math::ByteSwap (sint16v8_t value);
sint32v4_t Math::ByteSwap (sint32v4_t value);
sint64v2_t Math::ByteSwap (sint64v2_t value);

Description: Reverse byte order of the specified variable. This function is provided for converting little-endian values to big-endian format and vice versa.

Parameters:

  • value - source value for swapping bytes

Return value: Source value with changed byte order.

Bit reversal permutation

C
Unsigned integer types
uint8_t Math_BitReverse_uint8 (uint8_t value);
uint16_t Math_BitReverse_uint16 (uint16_t value);
uint32_t Math_BitReverse_uint32 (uint32_t value);
uint64_t Math_BitReverse_uint64 (uint64_t value);
uint8v16_t Math_BitReverse_uint8v16 (uint8v16_t value);
uint16v8_t Math_BitReverse_uint16v8 (uint16v8_t value);
uint32v4_t Math_BitReverse_uint32v4 (uint32v4_t value);
uint64v2_t Math_BitReverse_uint64v2 (uint64v2_t value);

Signed integer types
sint8_t Math_BitReverse_sint8 (sint8_t value);
sint16_t Math_BitReverse_sint16 (sint16_t value);
sint32_t Math_BitReverse_sint32 (sint32_t value);
sint64_t Math_BitReverse_sint64 (sint64_t value);
sint8v16_t Math_BitReverse_sint8v16 (sint8v16_t value);
sint16v8_t Math_BitReverse_sint16v8 (sint16v8_t value);
sint32v4_t Math_BitReverse_sint32v4 (sint32v4_t value);
sint64v2_t Math_BitReverse_sint64v2 (sint64v2_t value);
C++
Unsigned integer types
uint8_t Math::BitReverse (uint8_t value);
uint16_t Math::BitReverse (uint16_t value);
uint32_t Math::BitReverse (uint32_t value);
uint64_t Math::BitReverse (uint64_t value);
uint8v16_t Math::BitReverse (uint8v16_t value);
uint16v8_t Math::BitReverse (uint16v8_t value);
uint32v4_t Math::BitReverse (uint32v4_t value);
uint64v2_t Math::BitReverse (uint64v2_t value);

Signed integer types
sint8_t Math::BitReverse (sint8_t value);
sint16_t Math::BitReverse (sint16_t value);
sint32_t Math::BitReverse (sint32_t value);
sint64_t Math::BitReverse (sint64_t value);
sint8v16_t Math::BitReverse (sint8v16_t value);
sint16v8_t Math::BitReverse (sint16v8_t value);
sint32v4_t Math::BitReverse (sint32v4_t value);
sint64v2_t Math::BitReverse (sint64v2_t value);

Description: Reverse the binary digits order of the specified variable.

Parameters:

  • value - source value for bit-reversal permutation

Return value: Source value with changed binary digits order.

Bit scan

Bit scanning functions search the value for the least/most significant set bit and return its index. If the value is 0, then -1 is returned.

Bit scan forward

C
Unsigned integer types
uint8_t Math_ScanForward_uint8 (uint8_t value);
uint16_t Math_ScanForward_uint16 (uint16_t value);
uint32_t Math_ScanForward_uint32 (uint32_t value);
uint64_t Math_ScanForward_uint64 (uint64_t value);

Signed integer types
sint8_t Math_ScanForward_sint8 (sint8_t value);
sint16_t Math_ScanForward_sint16 (sint16_t value);
sint32_t Math_ScanForward_sint32 (sint32_t value);
sint64_t Math_ScanForward_sint64 (sint64_t value);
C++
Unsigned integer types
uint8_t Math::ScanForward (uint8_t value);
uint16_t Math::ScanForward (uint16_t value);
uint32_t Math::ScanForward (uint32_t value);
uint64_t Math::ScanForward (uint64_t value);

Signed integer types
sint8_t Math::ScanForward (sint8_t value);
sint16_t Math::ScanForward (sint16_t value);
sint32_t Math::ScanForward (sint32_t value);
sint64_t Math::ScanForward (sint64_t value);

Description: Search the value for the least significant set bit (1 bit). If a least significant 1 bit is found, then its index is returned. The bit index is an unsigned offset from bit 0. If the content of the value is 0, then -1 is returned.

Parameters:

  • value - source value for bit scanning

Return value:

  • Index of the least significant set bit.
  • -1 if the value has no set bits.

Bit scan backward

C
Unsigned integer types
uint8_t Math_ScanBackward_uint8 (uint8_t value);
uint16_t Math_ScanBackward_uint16 (uint16_t value);
uint32_t Math_ScanBackward_uint32 (uint32_t value);
uint64_t Math_ScanBackward_uint64 (uint64_t value);

Signed integer types
sint8_t Math_ScanBackward_sint8 (sint8_t value);
sint16_t Math_ScanBackward_sint16 (sint16_t value);
sint32_t Math_ScanBackward_sint32 (sint32_t value);
sint64_t Math_ScanBackward_sint64 (sint64_t value);
C++
Unsigned integer types
uint8_t Math::ScanBackward (uint8_t value);
uint16_t Math::ScanBackward (uint16_t value);
uint32_t Math::ScanBackward (uint32_t value);
uint64_t Math::ScanBackward (uint64_t value);

Signed integer types
sint8_t Math::ScanBackward (sint8_t value);
sint16_t Math::ScanBackward (sint16_t value);
sint32_t Math::ScanBackward (sint32_t value);
sint64_t Math::ScanBackward (sint64_t value);

Description: Search the value for the most significant set bit (1 bit). If a most significant 1 bit is found, then its index is returned. The bit index is an unsigned offset from bit 0. If the content of the value is 0, then -1 is returned.

Parameters:

  • value - source value for bit scanning

Return value:

  • Index of the most significant set bit.
  • -1 if the value has no set bits.

Circular rotation

The rotate left/right functions shift all the bits toward more/less significant bit positions, using circular rotation schema. This means that the most-significant bit, is rotated to the least-significant bit location and vise versa.

Circular rotation to the left

C
Unsigned integer types
uint8_t Math_RotateLeft_uint8 (uint8_t value, uint8_t shift);
uint16_t Math_RotateLeft_uint16 (uint16_t value, uint8_t shift);
uint32_t Math_RotateLeft_uint32 (uint32_t value, uint8_t shift);
uint64_t Math_RotateLeft_uint64 (uint64_t value, uint8_t shift);

Signed integer types
sint8_t Math_RotateLeft_sint8 (sint8_t value, uint8_t shift);
sint16_t Math_RotateLeft_sint16 (sint16_t value, uint8_t shift);
sint32_t Math_RotateLeft_sint32 (sint32_t value, uint8_t shift);
sint64_t Math_RotateLeft_sint64 (sint64_t value, uint8_t shift);
C++
Unsigned integer types
uint8_t Math::RotateLeft (uint8_t value, uint8_t shift);
uint16_t Math::RotateLeft (uint16_t value, uint8_t shift);
uint32_t Math::RotateLeft (uint32_t value, uint8_t shift);
uint64_t Math::RotateLeft (uint64_t value, uint8_t shift);

Signed integer types
sint8_t Math::RotateLeft (sint8_t value, uint8_t shift);
sint16_t Math::RotateLeft (sint16_t value, uint8_t shift);
sint32_t Math::RotateLeft (sint32_t value, uint8_t shift);
sint64_t Math::RotateLeft (sint64_t value, uint8_t shift);

Description: Shift all the bits toward more significant bit positions, except for the most significant bits, which is rotated to the least significant bits location.

Parameters:

  • value - source value
  • shift - count of bits for circular rotation

Return value: The value shifted to specified bits count.

Circular rotation to the right

C
Unsigned integer types
uint8_t Math_RotateRight_uint8 (uint8_t value, uint8_t shift);
uint16_t Math_RotateRight_uint16 (uint16_t value, uint8_t shift);
uint32_t Math_RotateRight_uint32 (uint32_t value, uint8_t shift);
uint64_t Math_RotateRight_uint64 (uint64_t value, uint8_t shift);

Signed integer types
sint8_t Math_RotateRight_sint8 (sint8_t value, uint8_t shift);
sint16_t Math_RotateRight_sint16 (sint16_t value, uint8_t shift);
sint32_t Math_RotateRight_sint32 (sint32_t value, uint8_t shift);
sint64_t Math_RotateRight_sint64 (sint64_t value, uint8_t shift);
C++
Unsigned integer types
uint8_t Math::RotateRight (uint8_t value, uint8_t shift);
uint16_t Math::RotateRight (uint16_t value, uint8_t shift);
uint32_t Math::RotateRight (uint32_t value, uint8_t shift);
uint64_t Math::RotateRight (uint64_t value, uint8_t shift);

Signed integer types
sint8_t Math::RotateRight (sint8_t value, uint8_t shift);
sint16_t Math::RotateRight (sint16_t value, uint8_t shift);
sint32_t Math::RotateRight (sint32_t value, uint8_t shift);
sint64_t Math::RotateRight (sint64_t value, uint8_t shift);

Description: Shift all the bits toward less significant bit positions, except for the least significant bits, which is rotated to the most significant bits location.

Parameters:

  • value - source value
  • shift - count of bits for circular rotation

Return value: The value shifted to specified bits count.

Population count

C
Unsigned integer types
uint8_t Math_PopCount_uint8 (uint8_t value);
uint16_t Math_PopCount_uint16 (uint16_t value);
uint32_t Math_PopCount_uint32 (uint32_t value);
uint64_t Math_PopCount_uint64 (uint64_t value);
uint8v16_t Math_PopCount_uint8v16 (uint8v16_t value);
uint16v8_t Math_PopCount_uint16v8 (uint16v8_t value);
uint32v4_t Math_PopCount_uint32v4 (uint32v4_t value);
uint64v2_t Math_PopCount_uint64v2 (uint64v2_t value);

Signed integer types
sint8_t Math_PopCount_sint8 (sint8_t value);
sint16_t Math_PopCount_sint16 (sint16_t value);
sint32_t Math_PopCount_sint32 (sint32_t value);
sint64_t Math_PopCount_sint64 (sint64_t value);
sint8v16_t Math_PopCount_sint8v16 (sint8v16_t value);
sint16v8_t Math_PopCount_sint16v8 (sint16v8_t value);
sint32v4_t Math_PopCount_sint32v4 (sint32v4_t value);
sint64v2_t Math_PopCount_sint64v2 (sint64v2_t value);
C++
Unsigned integer types
uint8_t Math::PopCount (uint8_t value);
uint16_t Math::PopCount (uint16_t value);
uint32_t Math::PopCount (uint32_t value);
uint64_t Math::PopCount (uint64_t value);
uint8v16_t Math::PopCount (uint8v16_t value);
uint16v8_t Math::PopCount (uint16v8_t value);
uint32v4_t Math::PopCount (uint32v4_t value);
uint64v2_t Math::PopCount (uint64v2_t value);

Signed integer types
sint8_t Math::PopCount (sint8_t value);
sint16_t Math::PopCount (sint16_t value);
sint32_t Math::PopCount (sint32_t value);
sint64_t Math::PopCount (sint64_t value);
sint8v16_t Math::PopCount (sint8v16_t value);
sint16v8_t Math::PopCount (sint16v8_t value);
sint32v4_t Math::PopCount (sint32v4_t value);
sint64v2_t Math::PopCount (sint64v2_t value);

Description: Calculate a number of bits set to 1 in the value.

Parameters:

  • value - source value for bits population count

Return value: The count of bits set to 1.

Arithmetic operations

This section covers most popular arithmetic operations, improved by speed. They provide fast replacement for standard math functions from the GNU C language library.

Absolute value

C
Signed integer types
uint8_t Math_Abs_sint8 (sint8_t value);
uint16_t Math_Abs_sint16 (sint16_t value);
uint32_t Math_Abs_sint32 (sint32_t value);
uint64_t Math_Abs_sint64 (sint64_t value);
uint8v16_t Math_Abs_sint8v16 (sint8v16_t value);
uint16v8_t Math_Abs_sint16v8 (sint16v8_t value);
uint32v4_t Math_Abs_sint32v4 (sint32v4_t value);
uint64v2_t Math_Abs_sint64v2 (sint64v2_t value);

Floating-point types
flt32_t Math_Abs_flt32 (flt32_t value);
flt64_t Math_Abs_flt64 (flt64_t value);
flt32v4_t Math_Abs_flt32v4 (flt32v4_t value);
flt64v2_t Math_Abs_flt64v2 (flt64v2_t value);
C++
Signed integer types
uint8_t Math::Abs (sint8_t value);
uint16_t Math::Abs (sint16_t value);
uint32_t Math::Abs (sint32_t value);
uint64_t Math::Abs (sint64_t value);
uint8v16_t Math::Abs (sint8v16_t value);
uint16v8_t Math::Abs (sint16v8_t value);
uint32v4_t Math::Abs (sint32v4_t value);
uint64v2_t Math::Abs (sint64v2_t value);

Floating-point types
flt32_t Math::Abs (flt32_t value);
flt64_t Math::Abs (flt64_t value);
flt32v4_t Math::Abs (flt32v4_t value);
flt64v2_t Math::Abs (flt64v2_t value);

Description: Compute absolute value of specified variable.

Parameters:

  • value - value to process

Return value: Absolute value of variable.

Negative absolute value

C
Signed integer types
sint8_t Math_NegAbs_sint8 (sint8_t value);
sint16_t Math_NegAbs_sint16 (sint16_t value);
sint32_t Math_NegAbs_sint32 (sint32_t value);
sint64_t Math_NegAbs_sint64 (sint64_t value);
sint8v16_t Math_NegAbs_sint8v16 (sint8v16_t value);
sint16v8_t Math_NegAbs_sint16v8 (sint16v8_t value);
sint32v4_t Math_NegAbs_sint32v4 (sint32v4_t value);
sint64v2_t Math_NegAbs_sint64v2 (sint64v2_t value);

Floating-point types
flt32_t Math_NegAbs_flt32 (flt32_t value);
flt64_t Math_NegAbs_flt64 (flt64_t value);
flt32v4_t Math_NegAbs_flt32v4 (flt32v4_t value);
flt64v2_t Math_NegAbs_flt64v2 (flt64v2_t value);
C++
Signed integer types
sint8_t Math::NegAbs (sint8_t value);
sint16_t Math::NegAbs (sint16_t value);
sint32_t Math::NegAbs (sint32_t value);
sint64_t Math::NegAbs (sint64_t value);
sint8v16_t Math::NegAbs (sint8v16_t value);
sint16v8_t Math::NegAbs (sint16v8_t value);
sint32v4_t Math::NegAbs (sint32v4_t value);
sint64v2_t Math::NegAbs (sint64v2_t value);

Floating-point types
flt32_t Math::NegAbs (flt32_t value);
flt64_t Math::NegAbs (flt64_t value);
flt32v4_t Math::NegAbs (flt32v4_t value);
flt64v2_t Math::NegAbs (flt64v2_t value);

Description: Compute negative absolute value of specified variable.

Parameters:

  • value - value to process

Return value: Negative absolute value of variable.

Number sign

C
Signed integer types
sint8_t Math_Sign_sint8 (sint8_t value);
sint16_t Math_Sign_sint16 (sint16_t value);
sint32_t Math_Sign_sint32 (sint32_t value);
sint64_t Math_Sign_sint64 (sint64_t value);
sint8v16_t Math_Sign_sint8v16 (sint8v16_t value);
sint16v8_t Math_Sign_sint16v8 (sint16v8_t value);
sint32v4_t Math_Sign_sint32v4 (sint32v4_t value);
sint64v2_t Math_Sign_sint64v2 (sint64v2_t value);

Floating-point types
flt32_t Math_Sign_flt32 (flt32_t value);
flt64_t Math_Sign_flt64 (flt64_t value);
flt32v4_t Math_Sign_flt32v4 (flt32v4_t value);
flt64v2_t Math_Sign_flt64v2 (flt64v2_t value);
C++
Signed integer types
sint8_t Math::Sign (sint8_t value);
sint16_t Math::Sign (sint16_t value);
sint32_t Math::Sign (sint32_t value);
sint64_t Math::Sign (sint64_t value);
sint8v16_t Math::Sign (sint8v16_t value);
sint16v8_t Math::Sign (sint16v8_t value);
sint32v4_t Math::Sign (sint32v4_t value);
sint64v2_t Math::Sign (sint64v2_t value);

Floating-point types
flt32_t Math::Sign (flt32_t value);
flt64_t Math::Sign (flt64_t value);
flt32v4_t Math::Sign (flt32v4_t value);
flt64v2_t Math::Sign (flt64v2_t value);

Description: Return sign of source number.

Parameters:

  • value - number value to process

Return value:

  • 0 if value is zero
  • +1 if value is positive
  • -1 if value is negative
  • NaN if value is NaN

Square root

C
Unsigned integer types
uint8_t Math_Sqrt_uint8 (uint8_t value);
uint16_t Math_Sqrt_uint16 (uint16_t value);
uint32_t Math_Sqrt_uint32 (uint32_t value);
uint64_t Math_Sqrt_uint64 (uint64_t value);

Floating-point types
flt32_t Math_Sqrt_flt32 (flt32_t value);
flt64_t Math_Sqrt_flt64 (flt64_t value);
flt32v4_t Math_Sqrt_flt32v4 (flt32v4_t value);
flt64v2_t Math_Sqrt_flt64v2 (flt64v2_t value);
C++
Unsigned integer types
uint8_t Math::Sqrt (uint8_t value);
uint16_t Math::Sqrt (uint16_t value);
uint32_t Math::Sqrt (uint32_t value);
uint64_t Math::Sqrt (uint64_t value);

Floating-point types
flt32_t Math::Sqrt (flt32_t value);
flt64_t Math::Sqrt (flt64_t value);
flt32v4_t Math::Sqrt (flt32v4_t value);
flt64v2_t Math::Sqrt (flt64v2_t value);

Description: Compute square root of specified variable.

Parameters:

  • value - value to process

Return value:

  • Square root of variable.
  • NaN (not a number) if variable is negative or NAN.

Square value

C
Unsigned integer types
uint8_t Math_Sqr_uint8 (uint8_t value);
uint16_t Math_Sqr_uint16 (uint16_t value);
uint32_t Math_Sqr_uint32 (uint32_t value);
uint64_t Math_Sqr_uint64 (uint64_t value);

Signed integer types
sint8_t Math_Sqr_sint8 (sint8_t value);
sint16_t Math_Sqr_sint16 (sint16_t value);
sint32_t Math_Sqr_sint32 (sint32_t value);
sint64_t Math_Sqr_sint64 (sint64_t value);

Floating-point types
flt32_t Math_Sqr_flt32 (flt32_t value);
flt64_t Math_Sqr_flt64 (flt64_t value);
flt32v4_t Math_Sqr_flt32v4 (flt32v4_t value);
flt64v2_t Math_Sqr_flt64v2 (flt64v2_t value);
C++
Unsigned integer types
uint8_t Math::Sqr (uint8_t value);
uint16_t Math::Sqr (uint16_t value);
uint32_t Math::Sqr (uint32_t value);
uint64_t Math::Sqr (uint64_t value);

Signed integer types
sint8_t Math::Sqr (sint8_t value);
sint16_t Math::Sqr (sint16_t value);
sint32_t Math::Sqr (sint32_t value);
sint64_t Math::Sqr (sint64_t value);

Floating-point types
flt32_t Math::Sqr (flt32_t value);
flt64_t Math::Sqr (flt64_t value);
flt32v4_t Math::Sqr (flt32v4_t value);
flt64v2_t Math::Sqr (flt64v2_t value);

Description: Compute square value of specified variable.

Parameters:

  • value - value to process

Return value:

  • Square value which is equal to value2.
  • NaN (not a number) if variable is NAN.

Cube value

C
Unsigned integer types
uint8_t Math_Cube_uint8 (uint8_t value);
uint16_t Math_Cube_uint16 (uint16_t value);
uint32_t Math_Cube_uint32 (uint32_t value);
uint64_t Math_Cube_uint64 (uint64_t value);

Signed integer types
sint8_t Math_Cube_sint8 (sint8_t value);
sint16_t Math_Cube_sint16 (sint16_t value);
sint32_t Math_Cube_sint32 (sint32_t value);
sint64_t Math_Cube_sint64 (sint64_t value);

Floating-point types
flt32_t Math_Cube_flt32 (flt32_t value);
flt64_t Math_Cube_flt64 (flt64_t value);
flt32v4_t Math_Cube_flt32v4 (flt32v4_t value);
flt64v2_t Math_Cube_flt64v2 (flt64v2_t value);
C++
Unsigned integer types
uint8_t Math::Cube (uint8_t value);
uint16_t Math::Cube (uint16_t value);
uint32_t Math::Cube (uint32_t value);
uint64_t Math::Cube (uint64_t value);

Signed integer types
sint8_t Math::Cube (sint8_t value);
sint16_t Math::Cube (sint16_t value);
sint32_t Math::Cube (sint32_t value);
sint64_t Math::Cube (sint64_t value);

Floating-point types
flt32_t Math::Cube (flt32_t value);
flt64_t Math::Cube (flt64_t value);
flt32v4_t Math::Cube (flt32v4_t value);
flt64v2_t Math::Cube (flt64v2_t value);

Description: Compute cube value of specified variable.

Parameters:

  • value - value to process

Return value:

  • Cube value which is equal to value3.
  • NaN (not a number) if variable is NAN.

Inverse value

Cflt32_t Math_InverseValue_flt32 (flt32_t value);
flt64_t Math_InverseValue_flt64 (flt64_t value);
flt32v4_t Math_InverseValue_flt32v4 (flt32v4_t value);
flt64v2_t Math_InverseValue_flt64v2 (flt64v2_t value);
C++flt32_t Math::InverseValue (flt32_t value);
flt64_t Math::InverseValue (flt64_t value);
flt32v4_t Math::InverseValue (flt32v4_t value);
flt64v2_t Math::InverseValue (flt64v2_t value);

Description: Compute inverse value.

Parameters:

  • value - value to process

Return value: Inverse value which is equal to 1.0 / value.

Inverse square value

Cflt32_t Math_InverseSquare_flt32 (flt32_t value);
flt64_t Math_InverseSquare_flt64 (flt64_t value);
flt32v4_t Math_InverseSquare_flt32v4 (flt32v4_t value);
flt64v2_t Math_InverseSquare_flt64v2 (flt64v2_t value);
C++flt32_t Math::InverseSquare (flt32_t value);
flt64_t Math::InverseSquare (flt64_t value);
flt32v4_t Math::InverseSquare (flt32v4_t value);
flt64v2_t Math::InverseSquare (flt64v2_t value);

Description: Compute inverse square value.

Parameters:

  • value - value to process

Return value: Inverse square value which is equal to 1.0 / value2.

Inverse cube value

Cflt32_t Math_InverseCube_flt32 (flt32_t value);
flt64_t Math_InverseCube_flt64 (flt64_t value);
flt32v4_t Math_InverseCube_flt32v4 (flt32v4_t value);
flt64v2_t Math_InverseCube_flt64v2 (flt64v2_t value);
C++flt32_t Math::InverseCube (flt32_t value);
flt64_t Math::InverseCube (flt64_t value);
flt32v4_t Math::InverseCube (flt32v4_t value);
flt64v2_t Math::InverseCube (flt64v2_t value);

Description: Compute inverse cube value.

Parameters:

  • value - value to process

Return value: Inverse cube value which is equal to 1.0 / value3.

Three-state comparison

C
Unsigned integer types
sint8_t Math_Compare_uint8 (uint8_t value1, uint8_t value2);
sint16_t Math_Compare_uint16 (uint16_t value1, uint16_t value2);
sint32_t Math_Compare_uint32 (uint32_t value1, uint32_t value2);
sint64_t Math_Compare_uint64 (uint64_t value1, uint64_t value2);
sint8v16_t Math_Compare_uint8v16 (uint8v16_t value1, uint8v16_t value2);
sint16v8_t Math_Compare_uint16v8 (uint16v8_t value1, uint16v8_t value2);
sint32v4_t Math_Compare_uint32v4 (uint32v4_t value1, uint32v4_t value2);
sint64v2_t Math_Compare_uint64v2 (uint64v2_t value1, uint64v2_t value2);

Signed integer types
sint8_t Math_Compare_sint8 (sint8_t value1, sint8_t value2);
sint16_t Math_Compare_sint16 (sint16_t value1, sint16_t value2);
sint32_t Math_Compare_sint32 (sint32_t value1, sint32_t value2);
sint64_t Math_Compare_sint64 (sint64_t value1, sint64_t value2);
sint8v16_t Math_Compare_sint8v16 (sint8v16_t value1, sint8v16_t value2);
sint16v8_t Math_Compare_sint16v8 (sint16v8_t value1, sint16v8_t value2);
sint32v4_t Math_Compare_sint32v4 (sint32v4_t value1, sint32v4_t value2);
sint64v2_t Math_Compare_sint64v2 (sint64v2_t value1, sint64v2_t value2);

Floating-point types
flt32_t Math_Compare_flt32 (flt32_t value1, flt32_t value2);
flt64_t Math_Compare_flt64 (flt64_t value1, flt64_t value2);
flt32v4_t Math_Compare_flt32v4 (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math_Compare_flt64v2 (flt64v2_t value1, flt64v2_t value2);
C++
Unsigned integer types
sint8_t Math::Compare (uint8_t value1, uint8_t value2);
sint16_t Math::Compare (uint16_t value1, uint16_t value2);
sint32_t Math::Compare (uint32_t value1, uint32_t value2);
sint64_t Math::Compare (uint64_t value1, uint64_t value2);
sint8v16_t Math::Compare (uint8v16_t value1, uint8v16_t value2);
sint16v8_t Math::Compare (uint16v8_t value1, uint16v8_t value2);
sint32v4_t Math::Compare (uint32v4_t value1, uint32v4_t value2);
sint64v2_t Math::Compare (uint64v2_t value1, uint64v2_t value2);

Signed integer types
sint8_t Math::Compare (sint8_t value1, sint8_t value2);
sint16_t Math::Compare (sint16_t value1, sint16_t value2);
sint32_t Math::Compare (sint32_t value1, sint32_t value2);
sint64_t Math::Compare (sint64_t value1, sint64_t value2);
sint8v16_t Math::Compare (sint8v16_t value1, sint8v16_t value2);
sint16v8_t Math::Compare (sint16v8_t value1, sint16v8_t value2);
sint32v4_t Math::Compare (sint32v4_t value1, sint32v4_t value2);
sint64v2_t Math::Compare (sint64v2_t value1, sint64v2_t value2);

Floating-point types
flt32_t Math::Compare (flt32_t value1, flt32_t value2);
flt64_t Math::Compare (flt64_t value1, flt64_t value2);
flt32v4_t Math::Compare (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math::Compare (flt64v2_t value1, flt64v2_t value2);

Description: Compare two numbers and return their relation as signed values: -1, 0 and +1. Floating-point variant also return NaN if at least one value is NaN.

Parameters:

  • value1 - first value
  • value2 - second value

Return value:

  • -1 if first value is less than second value
  • 0 if both values are equal
  • +1 if first value is great than second value
  • NaN if any of floating-point numbers has NaN value

Minimum and maximum absolute value

These functions compare two numbers and return the number with min/max absolute value. Floating-point variants always return NaN result if any number has NaN value.

Minimum absolute value

C
Signed integer types
uint8_t Math_MinAbs_sint8 (sint8_t value1, sint8_t value2);
uint16_t Math_MinAbs_sint16 (sint16_t value1, sint16_t value2);
uint32_t Math_MinAbs_sint32 (sint32_t value1, sint32_t value2);
uint64_t Math_MinAbs_sint64 (sint64_t value1, sint64_t value2);
uint8v16_t Math_MinAbs_sint8v16 (sint8v16_t value1, sint8v16_t value2);
uint16v8_t Math_MinAbs_sint16v8 (sint16v8_t value1, sint16v8_t value2);
uint32v4_t Math_MinAbs_sint32v4 (sint32v4_t value1, sint32v4_t value2);

Floating-point types
flt32_t Math_MinAbs_flt32 (flt32_t value1, flt32_t value2);
flt64_t Math_MinAbs_flt64 (flt64_t value1, flt64_t value2);
flt32v4_t Math_MinAbs_flt32v4 (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math_MinAbs_flt64v2 (flt64v2_t value1, flt64v2_t value2);
C++
Signed integer types
uint8_t Math::MinAbs (sint8_t value1, sint8_t value2);
uint16_t Math::MinAbs (sint16_t value1, sint16_t value2);
uint32_t Math::MinAbs (sint32_t value1, sint32_t value2);
uint64_t Math::MinAbs (sint64_t value1, sint64_t value2);
uint8v16_t Math::MinAbs (sint8v16_t value1, sint8v16_t value2);
uint16v8_t Math::MinAbs (sint16v8_t value1, sint16v8_t value2);
uint32v4_t Math::MinAbs (sint32v4_t value1, sint32v4_t value2);

Floating-point types
flt32_t Math::MinAbs (flt32_t value1, flt32_t value2);
flt64_t Math::MinAbs (flt64_t value1, flt64_t value2);
flt32v4_t Math::MinAbs (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math::MinAbs (flt64v2_t value1, flt64v2_t value2);

Description: Find minimum absolute value between variable values.

Parameters:

  • value1 - first value
  • value2 - second value

Return value:

  • Minimum absolute value between first and second variable.
  • NaN (not a number) if any of the variables has NaN value.

Maximum absolute value

C
Signed integer types
uint8_t Math_MaxAbs_sint8 (sint8_t value1, sint8_t value2);
uint16_t Math_MaxAbs_sint16 (sint16_t value1, sint16_t value2);
uint32_t Math_MaxAbs_sint32 (sint32_t value1, sint32_t value2);
uint64_t Math_MaxAbs_sint64 (sint64_t value1, sint64_t value2);
uint8v16_t Math_MaxAbs_sint8v16 (sint8v16_t value1, sint8v16_t value2);
uint16v8_t Math_MaxAbs_sint16v8 (sint16v8_t value1, sint16v8_t value2);
uint32v4_t Math_MaxAbs_sint32v4 (sint32v4_t value1, sint32v4_t value2);

Floating-point types
flt32_t Math_MaxAbs_flt32 (flt32_t value1, flt32_t value2);
flt64_t Math_MaxAbs_flt64 (flt64_t value1, flt64_t value2);
flt32v4_t Math_MaxAbs_flt32v4 (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math_MaxAbs_flt64v2 (flt64v2_t value1, flt64v2_t value2);
C++
Signed integer types
uint8_t Math::MaxAbs (sint8_t value1, sint8_t value2);
uint16_t Math::MaxAbs (sint16_t value1, sint16_t value2);
uint32_t Math::MaxAbs (sint32_t value1, sint32_t value2);
uint64_t Math::MaxAbs (sint64_t value1, sint64_t value2);
uint8v16_t Math::MaxAbs (sint8v16_t value1, sint8v16_t value2);
uint16v8_t Math::MaxAbs (sint16v8_t value1, sint16v8_t value2);
uint32v4_t Math::MaxAbs (sint32v4_t value1, sint32v4_t value2);

Floating-point types
flt32_t Math::MaxAbs (flt32_t value1, flt32_t value2);
flt64_t Math::MaxAbs (flt64_t value1, flt64_t value2);
flt32v4_t Math::MaxAbs (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math::MaxAbs (flt64v2_t value1, flt64v2_t value2);

Description: Find maximum absolute value between variable values.

Parameters:

  • value1 - first value
  • value2 - second value

Return value:

  • Maximum absolute value between first and second variable.
  • NaN (not a number) if any of the variables has NaN value.

Minimum and maximum value

These functions compare two numbers and return the number with min/max value. Floating-point variants always return NaN result if any number has NaN value.

Minimum value

C
Unsigned integer types
uint8_t Math_Min_uint8 (uint8_t value1, uint8_t value2);
uint16_t Math_Min_uint16 (uint16_t value1, uint16_t value2);
uint32_t Math_Min_uint32 (uint32_t value1, uint32_t value2);
uint64_t Math_Min_uint64 (uint64_t value1, uint64_t value2);
uint8v16_t Math_Min_uint8v16 (uint8v16_t value1, uint8v16_t value2);
uint16v8_t Math_Min_uint16v8 (uint16v8_t value1, uint16v8_t value2);
uint32v4_t Math_Min_uint32v4 (uint32v4_t value1, uint32v4_t value2);

Signed integer types
sint8_t Math_Min_sint8 (sint8_t value1, sint8_t value2);
sint16_t Math_Min_sint16 (sint16_t value1, sint16_t value2);
sint32_t Math_Min_sint32 (sint32_t value1, sint32_t value2);
sint64_t Math_Min_sint64 (sint64_t value1, sint64_t value2);
sint8v16_t Math_Min_sint8v16 (sint8v16_t value1, sint8v16_t value2);
sint16v8_t Math_Min_sint16v8 (sint16v8_t value1, sint16v8_t value2);
sint32v4_t Math_Min_sint32v4 (sint32v4_t value1, sint32v4_t value2);

Floating-point types
flt32_t Math_Min_flt32 (flt32_t value1, flt32_t value2);
flt64_t Math_Min_flt64 (flt64_t value1, flt64_t value2);
flt32v4_t Math_Min_flt32v4 (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math_Min_flt64v2 (flt64v2_t value1, flt64v2_t value2);
C++
Unsigned integer types
uint8_t Math::Min (uint8_t value1, uint8_t value2);
uint16_t Math::Min (uint16_t value1, uint16_t value2);
uint32_t Math::Min (uint32_t value1, uint32_t value2);
uint64_t Math::Min (uint64_t value1, uint64_t value2);
uint8v16_t Math::Min (uint8v16_t value1, uint8v16_t value2);
uint16v8_t Math::Min (uint16v8_t value1, uint16v8_t value2);
uint32v4_t Math::Min (uint32v4_t value1, uint32v4_t value2);

Signed integer types
sint8_t Math::Min (sint8_t value1, sint8_t value2);
sint16_t Math::Min (sint16_t value1, sint16_t value2);
sint32_t Math::Min (sint32_t value1, sint32_t value2);
sint64_t Math::Min (sint64_t value1, sint64_t value2);
sint8v16_t Math::Min (sint8v16_t value1, sint8v16_t value2);
sint16v8_t Math::Min (sint16v8_t value1, sint16v8_t value2);
sint32v4_t Math::Min (sint32v4_t value1, sint32v4_t value2);

Floating-point types
flt32_t Math::Min (flt32_t value1, flt32_t value2);
flt64_t Math::Min (flt64_t value1, flt64_t value2);
flt32v4_t Math::Min (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math::Min (flt64v2_t value1, flt64v2_t value2);

Description: Find minimum value between variable values.

Parameters:

  • value1 - first value
  • value2 - second value

Return value:

  • Minimum value between first and second variable.
  • NaN (not a number) if any of the variables has NaN value.

Maximum value

C
Unsigned integer types
uint8_t Math_Max_uint8 (uint8_t value1, uint8_t value2);
uint16_t Math_Max_uint16 (uint16_t value1, uint16_t value2);
uint32_t Math_Max_uint32 (uint32_t value1, uint32_t value2);
uint64_t Math_Max_uint64 (uint64_t value1, uint64_t value2);
uint8v16_t Math_Max_uint8v16 (uint8v16_t value1, uint8v16_t value2);
uint16v8_t Math_Max_uint16v8 (uint16v8_t value1, uint16v8_t value2);
uint32v4_t Math_Max_uint32v4 (uint32v4_t value1, uint32v4_t value2);

Signed integer types
sint8_t Math_Max_sint8 (sint8_t value1, sint8_t value2);
sint16_t Math_Max_sint16 (sint16_t value1, sint16_t value2);
sint32_t Math_Max_sint32 (sint32_t value1, sint32_t value2);
sint64_t Math_Max_sint64 (sint64_t value1, sint64_t value2);
sint8v16_t Math_Max_sint8v16 (sint8v16_t value1, sint8v16_t value2);
sint16v8_t Math_Max_sint16v8 (sint16v8_t value1, sint16v8_t value2);
sint32v4_t Math_Max_sint32v4 (sint32v4_t value1, sint32v4_t value2);

Floating-point types
flt32_t Math_Max_flt32 (flt32_t value1, flt32_t value2);
flt64_t Math_Max_flt64 (flt64_t value1, flt64_t value2);
flt32v4_t Math_Max_flt32v4 (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math_Max_flt64v2 (flt64v2_t value1, flt64v2_t value2);
C++
Unsigned integer types
uint8_t Math::Max (uint8_t value1, uint8_t value2);
uint16_t Math::Max (uint16_t value1, uint16_t value2);
uint32_t Math::Max (uint32_t value1, uint32_t value2);
uint64_t Math::Max (uint64_t value1, uint64_t value2);
uint8v16_t Math::Max (uint8v16_t value1, uint8v16_t value2);
uint16v8_t Math::Max (uint16v8_t value1, uint16v8_t value2);
uint32v4_t Math::Max (uint32v4_t value1, uint32v4_t value2);

Signed integer types
sint8_t Math::Max (sint8_t value1, sint8_t value2);
sint16_t Math::Max (sint16_t value1, sint16_t value2);
sint32_t Math::Max (sint32_t value1, sint32_t value2);
sint64_t Math::Max (sint64_t value1, sint64_t value2);
sint8v16_t Math::Max (sint8v16_t value1, sint8v16_t value2);
sint16v8_t Math::Max (sint16v8_t value1, sint16v8_t value2);
sint32v4_t Math::Max (sint32v4_t value1, sint32v4_t value2);

Floating-point types
flt32_t Math::Max (flt32_t value1, flt32_t value2);
flt64_t Math::Max (flt64_t value1, flt64_t value2);
flt32v4_t Math::Max (flt32v4_t value1, flt32v4_t value2);
flt64v2_t Math::Max (flt64v2_t value1, flt64v2_t value2);

Description: Find maximum value between variable values.

Parameters:

  • value1 - first value
  • value2 - second value

Return value:

  • Maximum value between first and second variable.
  • NaN (not a number) if any of the variables has NaN value.

Greatest common divisor

C
Unsigned integer types
uint8_t Math_GCD_uint8 (uint8_t value1, uint8_t value2);
uint16_t Math_GCD_uint16 (uint16_t value1, uint16_t value2);
uint32_t Math_GCD_uint32 (uint32_t value1, uint32_t value2);
uint64_t Math_GCD_uint64 (uint64_t value1, uint64_t value2);

Signed integer types
uint8_t Math_GCD_sint8 (sint8_t value1, sint8_t value2);
uint16_t Math_GCD_sint16 (sint16_t value1, sint16_t value2);
uint32_t Math_GCD_sint32 (sint32_t value1, sint32_t value2);
uint64_t Math_GCD_sint64 (sint64_t value1, sint64_t value2);
C++
Unsigned integer types
uint8_t Math::GCD (uint8_t value1, uint8_t value2);
uint16_t Math::GCD (uint16_t value1, uint16_t value2);
uint32_t Math::GCD (uint32_t value1, uint32_t value2);
uint64_t Math::GCD (uint64_t value1, uint64_t value2);

Signed integer types
uint8_t Math::GCD (sint8_t value1, sint8_t value2);
uint16_t Math::GCD (sint16_t value1, sint16_t value2);
uint32_t Math::GCD (sint32_t value1, sint32_t value2);
uint64_t Math::GCD (sint64_t value1, sint64_t value2);

Description: Compute greatest common divisor (GCD) of two integers.

Parameters:

  • value1 - first value
  • value2 - second value

Return value:

  • The largest positive integer that divides the numbers without a remainder.
  • 0 (zero) if both values are equal to zero.

Least common multiple

C
Unsigned integer types
uint8_t Math_LCM_uint8 (uint8_t value1, uint8_t value2);
uint16_t Math_LCM_uint16 (uint16_t value1, uint16_t value2);
uint32_t Math_LCM_uint32 (uint32_t value1, uint32_t value2);
uint64_t Math_LCM_uint64 (uint64_t value1, uint64_t value2);

Signed integer types
uint8_t Math_LCM_sint8 (sint8_t value1, sint8_t value2);
uint16_t Math_LCM_sint16 (sint16_t value1, sint16_t value2);
uint32_t Math_LCM_sint32 (sint32_t value1, sint32_t value2);
uint64_t Math_LCM_sint64 (sint64_t value1, sint64_t value2);
C++
Unsigned integer types
uint8_t Math::LCM (uint8_t value1, uint8_t value2);
uint16_t Math::LCM (uint16_t value1, uint16_t value2);
uint32_t Math::LCM (uint32_t value1, uint32_t value2);
uint64_t Math::LCM (uint64_t value1, uint64_t value2);

Signed integer types
uint8_t Math::LCM (sint8_t value1, sint8_t value2);
uint16_t Math::LCM (sint16_t value1, sint16_t value2);
uint32_t Math::LCM (sint32_t value1, sint32_t value2);
uint64_t Math::LCM (sint64_t value1, sint64_t value2);

Description: Compute least common multiple (LCM) of two integers.

Parameters:

  • value1 - first value
  • value2 - second value

Return value:

  • The smallest positive integer that is divisible by both numbers.
  • 0 (zero) if both values are zero, or result is too big to fit in target data type. This means that result is incorrect.

Cancellation

C
Unsigned integer types
void Math_Cancel_uint8 (uint8_t *value1, uint8_t *value2);
void Math_Cancel_uint16 (uint16_t *value1, uint16_t *value2);
void Math_Cancel_uint32 (uint32_t *value1, uint32_t *value2);
void Math_Cancel_uint64 (uint64_t *value1, uint64_t *value2);

Signed integer types
void Math_Cancel_sint8 (sint8_t *value1, sint8_t *value2);
void Math_Cancel_sint16 (sint16_t *value1, sint16_t *value2);
void Math_Cancel_sint32 (sint32_t *value1, sint32_t *value2);
void Math_Cancel_sint64 (sint64_t *value1, sint64_t *value2);
C++
Unsigned integer types
void Math::Cancel (uint8_t *value1, uint8_t *value2);
void Math::Cancel (uint16_t *value1, uint16_t *value2);
void Math::Cancel (uint32_t *value1, uint32_t *value2);
void Math::Cancel (uint64_t *value1, uint64_t *value2);

Signed integer types
void Math::Cancel (sint8_t *value1, sint8_t *value2);
void Math::Cancel (sint16_t *value1, sint16_t *value2);
void Math::Cancel (sint32_t *value1, sint32_t *value2);
void Math::Cancel (sint64_t *value1, sint64_t *value2);

Description: Cancel two values, dividing them to greatest common divisor.

Parameters:

  • value1 - pointer to first value
  • value2 - pointer to second value

Return value: None.

Observational error

Observational error (or measurement error) is the difference between a measured (approximate) value of quantity and its true (accurate) value.

Absolute error

Cflt32_t Math_AbsError_flt32 (flt32_t approximate, flt32_t accurate);
flt64_t Math_AbsError_flt64 (flt64_t approximate, flt64_t accurate);
flt32v4_t Math_AbsError_flt32v4 (flt32v4_t approximate, flt32v4_t accurate);
flt64v2_t Math_AbsError_flt64v2 (flt64v2_t approximate, flt64v2_t accurate);
C++flt32_t Math::AbsError (flt32_t approximate, flt32_t accurate);
flt64_t Math::AbsError (flt64_t approximate, flt64_t accurate);
flt32v4_t Math::AbsError (flt32v4_t approximate, flt32v4_t accurate);
flt64v2_t Math::AbsError (flt64v2_t approximate, flt64v2_t accurate);

Description: Compute absolute error between approximate and accurate values.

Parameters:

  • approximate - approximate value
  • accurate - accurate value

Return value:

  • Absolute error, computed as Abs (approximate - accurate)
  • NaN (not a number) if either of function parameters is NaN, or both parameters are equal to infinity value with the same sign.

Relative error

Cflt32_t Math_RelError_flt32 (flt32_t approximate, flt32_t accurate);
flt64_t Math_RelError_flt64 (flt64_t approximate, flt64_t accurate);
flt32v4_t Math_RelError_flt32v4 (flt32v4_t approximate, flt32v4_t accurate);
flt64v2_t Math_RelError_flt64v2 (flt64v2_t approximate, flt64v2_t accurate);
C++flt32_t Math::RelError (flt32_t approximate, flt32_t accurate);
flt64_t Math::RelError (flt64_t approximate, flt64_t accurate);
flt32v4_t Math::RelError (flt32v4_t approximate, flt32v4_t accurate);
flt64v2_t Math::RelError (flt64v2_t approximate, flt64v2_t accurate);

Description: Compute relative error between approximate and accurate values.

Parameters:

  • approximate - approximate value
  • accurate - accurate value

Return value:

  • Relative error, computed as Abs ((approximate - accurate) / accurate).
  • NaN (not a number) if either of function parameters is NaN, or both parameters are equal to infinity value with the same sign, or accurate value is equal to zero.

Scale functions

Scale functions multiply source value to specified base raised to power, and then return new value as function result.

Scale by power of 2

Cflt32_t Math_Scale2_flt32 (flt32_t value, sint16_t exp);
flt64_t Math_Scale2_flt64 (flt64_t value, sint16_t exp);
C++flt32_t Math::Scale2 (flt32_t value, sint16_t exp);
flt64_t Math::Scale2 (flt64_t value, sint16_t exp);

Description: Scale value by 2 raised to specified power, where power is an integer value.

Parameters:

  • value - source value for scale
  • exp - power value to compute

Return value: Source value multiplied to 2x.

Scale by power of 10

Cflt32_t Math_Scale10_flt32 (flt32_t value, sint16_t exp);
flt64_t Math_Scale10_flt64 (flt64_t value, sint16_t exp);
C++flt32_t Math::Scale10 (flt32_t value, sint16_t exp);
flt64_t Math::Scale10 (flt64_t value, sint16_t exp);

Description: Scale value by 10 raised to specified power, where power is an integer value.

Parameters:

  • value - source value for scale
  • exp - power value to compute

Return value: Source value multiplied to 10x.

Exponentiation functions

These are general exponentiation functions, returning specified base raised to provided power.

Exponentiation by base 2

Compute 2 raised to "exp" power.

Integer exponentiation by base 2

Cuint64_t Math_Exp2i_uint64 (uint8_t exp);
flt32_t Math_Exp2i_flt32 (sint8_t exp);
flt64_t Math_Exp2i_flt64 (sint16_t exp);
C++uint64_t Math::Exp2i (uint8_t exp);
flt32_t Math::Exp2i (sint8_t exp);
flt64_t Math::Exp2i (sint16_t exp);

Description: Compute 2 raised to specified power, where power is an integer value.

Parameters:

  • exp - power value to compute

Return value:

  • Value of 2x.
  • 0 (zero) in case of integer value overflow.
  • Inf (infinity) in case of floating-point value overflow.

Real exponentiation by base 2

Cflt32_t Math_Exp2_flt32 (flt32_t exp);
flt64_t Math_Exp2_flt64 (flt64_t exp);
flt32v4_t Math_Exp2_flt32v4 (flt32v4_t exp);
flt64v2_t Math_Exp2_flt64v2 (flt64v2_t exp);
C++flt32_t Math::Exp2 (flt32_t exp);
flt64_t Math::Exp2 (flt64_t exp);
flt32v4_t Math::Exp2 (flt32v4_t exp);
flt64v2_t Math::Exp2 (flt64v2_t exp);

Description: Calculate 2 raised to specified power, where power is a floating-point value.

Parameters:

  • exp - power value to compute

Return value:

  • Value of 2x.
  • NaN (not a number) if value is NaN.
  • +Inf (plus infinity) if result is too big and cannot be represented in floating-point format.
  • Subnormal value in case of underflow.
  • 0 (zero) if exponent value can not be represented as subnormal value.
Cflt32_t Math_Exp2m1_flt32 (flt32_t exp);
flt64_t Math_Exp2m1_flt64 (flt64_t exp);
flt32v4_t Math_Exp2m1_flt32v4 (flt32v4_t exp);
flt64v2_t Math_Exp2m1_flt64v2 (flt64v2_t exp);
C++flt32_t Math::Exp2m1 (flt32_t exp);
flt64_t Math::Exp2m1 (flt64_t exp);
flt32v4_t Math::Exp2m1 (flt32v4_t exp);
flt64v2_t Math::Exp2m1 (flt64v2_t exp);

Description: Calculate 2 raised to specified power minus one, where power is a floating-point value.

Parameters:

  • exp - power value to compute

Return value:

  • Value of 2x - 1.
  • NaN (not a number) if value is NaN.
  • +Inf (plus infinity) if result is too big and cannot be represented in floating-point format.
  • Subnormal value in case of underflow.
  • 0 (zero) if exponent value can not be represented as subnormal value.

Exponentiation by base 10

Compute 10 raised to "exp" power.

Integer exponentiation by base 10

Cuint64_t Math_Exp10i_uint64 (uint8_t exp);
flt32_t Math_Exp10i_flt32 (sint8_t exp);
flt64_t Math_Exp10i_flt64 (sint16_t exp);
C++uint64_t Math::Exp10i (uint8_t exp);
flt32_t Math::Exp10i (sint8_t exp);
flt64_t Math::Exp10i (sint16_t exp);

Description: Compute 10 raised to specified power, where power is an integer value.

Parameters:

  • exp - power value to compute

Return value:

  • Value of 10x.
  • 0 (zero) in case of integer value overflow.
  • Inf (infinity) in case of floating-point value overflow.

Real exponentiation by base 10

Cflt32_t Math_Exp10_flt32 (flt32_t exp);
flt64_t Math_Exp10_flt64 (flt64_t exp);
flt32v4_t Math_Exp10_flt32v4 (flt32v4_t exp);
flt64v2_t Math_Exp10_flt64v2 (flt64v2_t exp);
C++flt32_t Math::Exp10 (flt32_t exp);
flt64_t Math::Exp10 (flt64_t exp);
flt32v4_t Math::Exp10 (flt32v4_t exp);
flt64v2_t Math::Exp10 (flt64v2_t exp);

Description: Calculate 10 raised to specified power, where power is a floating-point value.

Parameters:

  • exp - power value to compute

Return value:

  • Value of 10x.
  • NaN (not a number) if value is NaN.
  • +Inf (plus infinity) if result is too big and cannot be represented in floating-point format.
  • Subnormal value in case of underflow.
  • 0 (zero) if exponent value can not be represented as subnormal value.
Cflt32_t Math_Exp10m1_flt32 (flt32_t exp);
flt64_t Math_Exp10m1_flt64 (flt64_t exp);
flt32v4_t Math_Exp10m1_flt32v4 (flt32v4_t exp);
flt64v2_t Math_Exp10m1_flt64v2 (flt64v2_t exp);
C++flt32_t Math::Exp10m1 (flt32_t exp);
flt64_t Math::Exp10m1 (flt64_t exp);
flt32v4_t Math::Exp10m1 (flt32v4_t exp);
flt64v2_t Math::Exp10m1 (flt64v2_t exp);

Description: Calculate 10 raised to specified power minus one, where power is a floating-point value.

Parameters:

  • exp - power value to compute

Return value:

  • Value of 10x - 1.
  • NaN (not a number) if value is NaN.
  • +Inf (plus infinity) if result is too big and cannot be represented in floating-point format.
  • Subnormal value in case of underflow.
  • 0 (zero) if exponent value can not be represented as subnormal value.

Exponentiation by base E (natural logarithm)

Compute e (base of natural logarithm) raised to "exp" power.

Cflt32_t Math_Exp_flt32 (flt32_t exp);
flt64_t Math_Exp_flt64 (flt64_t exp);
flt32v4_t Math_Exp_flt32v4 (flt32v4_t exp);
flt64v2_t Math_Exp_flt64v2 (flt64v2_t exp);
C++flt32_t Math::Exp (flt32_t exp);
flt64_t Math::Exp (flt64_t exp);
flt32v4_t Math::Exp (flt32v4_t exp);
flt64v2_t Math::Exp (flt64v2_t exp);

Description: Calculate e (base of natural logarithm) raised to specified power, where power is a floating-point value.

Parameters:

  • exp - power value to compute

Return value:

  • Value of Ex.
  • NaN (not a number) if value is NaN.
  • +Inf (plus infinity) if result is too big and cannot be represented in floating-point format.
  • Subnormal value in case of underflow.
  • 0 (zero) if exponent value can not be represented as subnormal value.
Cflt32_t Math_Expm1_flt32 (flt32_t exp);
flt64_t Math_Expm1_flt64 (flt64_t exp);
flt32v4_t Math_Expm1_flt32v4 (flt32v4_t exp);
flt64v2_t Math_Expm1_flt64v2 (flt64v2_t exp);
C++flt32_t Math::Expm1 (flt32_t exp);
flt64_t Math::Expm1 (flt64_t exp);
flt32v4_t Math::Expm1 (flt32v4_t exp);
flt64v2_t Math::Expm1 (flt64v2_t exp);

Description: Calculate e (base of natural logarithm) raised to specified power minus one, where power is a floating-point value.

Parameters:

  • exp - power value to compute

Return value:

  • Value of Ex - 1.
  • NaN (not a number) if value is NaN.
  • +Inf (plus infinity) if result is too big and cannot be represented in floating-point format.
  • Subnormal value in case of underflow.
  • 0 (zero) if exponent value can not be represented as subnormal value.

Exponentiation by custom base

Compute "base" raised to "exp" power.

Integer exponentiation by custom base

C
Unsigned integer types
uint8_t Math_ExpBi_uint8 (uint8_t base, uint8_t exp);
uint16_t Math_ExpBi_uint16 (uint16_t base, uint8_t exp);
uint32_t Math_ExpBi_uint32 (uint32_t base, uint8_t exp);
uint64_t Math_ExpBi_uint64 (uint64_t base, uint8_t exp);

Signed integer types
sint8_t Math_ExpBi_sint8 (sint8_t base, uint8_t exp);
sint16_t Math_ExpBi_sint16 (sint16_t base, uint8_t exp);
sint32_t Math_ExpBi_sint32 (sint32_t base, uint8_t exp);
sint64_t Math_ExpBi_sint64 (sint64_t base, uint8_t exp);
C++
Unsigned integer types
uint8_t Math::ExpBi (uint8_t base, uint8_t exp);
uint16_t Math::ExpBi (uint16_t base, uint8_t exp);
uint32_t Math::ExpBi (uint32_t base, uint8_t exp);
uint64_t Math::ExpBi (uint64_t base, uint8_t exp);

Signed integer types
sint8_t Math::ExpBi (sint8_t base, uint8_t exp);
sint16_t Math::ExpBi (sint16_t base, uint8_t exp);
sint32_t Math::ExpBi (sint32_t base, uint8_t exp);
sint64_t Math::ExpBi (sint64_t base, uint8_t exp);

Description: Compute specified base raised to integer power.

Parameters:

  • base - base for raise
  • exp - power value to compute

Return value:

  • Value of base raised to "exp" power.
  • 0 (zero) in case of integer value overflow, or both integer arguments (base and power) are equal to zero.

Real exponentiation by custom base

Cflt32_t Math_ExpB_flt32 (flt32_t base, flt32_t exp);
flt64_t Math_ExpB_flt64 (flt64_t base, flt64_t exp);
flt32v4_t Math_ExpB_flt32v4 (flt32v4_t base, flt32v4_t exp);
flt64v2_t Math_ExpB_flt64v2 (flt64v2_t base, flt64v2_t exp);
C++flt32_t Math::ExpB (flt32_t base, flt32_t exp);
flt64_t Math::ExpB (flt64_t base, flt64_t exp);
flt32v4_t Math::ExpB (flt32v4_t base, flt32v4_t exp);
flt64v2_t Math::ExpB (flt64v2_t base, flt64v2_t exp);

Description: Calculate "base" raised to specified power, where power is a floating-point value.

Parameters:

  • base - base value
  • exp - power value to compute

Return value:

  • Value of Bx.
  • NaN (not a number) if value is NaN, or base is less than zero or NaN, or both arguments (base and power) are equal to zero.
  • +Inf (plus infinity) if result is too big and cannot be represented in floating-point format.
  • Subnormal value in case of underflow.
  • 0 (zero) if exponent value can not be represented as subnormal value.
Cflt32_t Math_ExpBm1_flt32 (flt32_t base, flt32_t exp);
flt64_t Math_ExpBm1_flt64 (flt64_t base, flt64_t exp);
flt32v4_t Math_ExpBm1_flt32v4 (flt32v4_t base, flt32v4_t exp);
flt64v2_t Math_ExpBm1_flt64v2 (flt64v2_t base, flt64v2_t exp);
C++flt32_t Math::ExpBm1 (flt32_t base, flt32_t exp);
flt64_t Math::ExpBm1 (flt64_t base, flt64_t exp);
flt32v4_t Math::ExpBm1 (flt32v4_t base, flt32v4_t exp);
flt64v2_t Math::ExpBm1 (flt64v2_t base, flt64v2_t exp);

Description: Calculate "base" raised to specified power minus one, where power is a floating-point value.

Parameters:

  • base - base value
  • exp - power value to compute

Return value:

  • Value of Bx - 1.
  • NaN (not a number) if value is NaN, or base is less than zero or NaN, or both arguments (base and power) are equal to zero.
  • +Inf (plus infinity) if result is too big and cannot be represented in floating-point format.
  • Subnormal value in case of underflow.
  • 0 (zero) if exponent value can not be represented as subnormal value.

Logarithmic functions

Logarithmic functions return exponent to which the base, must be raised to produce passed value.

Logarithm to base 2

Compute logarithm value to base 2.

Integer logarithm to base 2

Cuint8_t Math_Log2i_uint8 (uint8_t value);
uint8_t Math_Log2i_uint16 (uint16_t value);
uint8_t Math_Log2i_uint32 (uint32_t value);
uint8_t Math_Log2i_uint64 (uint64_t value);
C++uint8_t Math::Log2i (uint8_t value);
uint8_t Math::Log2i (uint16_t value);
uint8_t Math::Log2i (uint32_t value);
uint8_t Math::Log2i (uint64_t value);

Description: Compute integer logarithm to base 2.

Parameters:

  • value - value to find its logarithm

Return value:

  • Integer logarithm to base 2 rounded to zero.
  • -1 if value is equal to 0.

Real logarithm to base 2

Cflt32_t Math_Log2_flt32 (flt32_t value);
flt64_t Math_Log2_flt64 (flt64_t value);
flt32v4_t Math_Log2_flt32v4 (flt32v4_t value);
flt64v2_t Math_Log2_flt64v2 (flt64v2_t value);
C++flt32_t Math::Log2 (flt32_t value);
flt64_t Math::Log2 (flt64_t value);
flt32v4_t Math::Log2 (flt32v4_t value);
flt64v2_t Math::Log2 (flt64v2_t value);

Description: Compute logarithm to base 2 of specified value.

Parameters:

  • value - value to find its logarithm

Return value:

  • Logarithm value to base 2.
  • NaN (not a number) if value is less than or equal to 0.
Cflt32_t Math_Log2p1_flt32 (flt32_t value);
flt64_t Math_Log2p1_flt64 (flt64_t value);
flt32v4_t Math_Log2p1_flt32v4 (flt32v4_t value);
flt64v2_t Math_Log2p1_flt64v2 (flt64v2_t value);
C++flt32_t Math::Log2p1 (flt32_t value);
flt64_t Math::Log2p1 (flt64_t value);
flt32v4_t Math::Log2p1 (flt32v4_t value);
flt64v2_t Math::Log2p1 (flt64v2_t value);

Description: Compute logarithm to base 2 of specified value plus 1.

Parameters:

  • value - value to find its logarithm

Return value:

  • Logarithm value to base 2.
  • NaN (not a number) if value is less than or equal to -1.

Logarithm to base 10

Compute logarithm value to base 10.

Integer logarithm to base 10

Cuint8_t Math_Log10i_uint8 (uint8_t value);
uint8_t Math_Log10i_uint16 (uint16_t value);
uint8_t Math_Log10i_uint32 (uint32_t value);
uint8_t Math_Log10i_uint64 (uint64_t value);
C++uint8_t Math::Log10i (uint8_t value);
uint8_t Math::Log10i (uint16_t value);
uint8_t Math::Log10i (uint32_t value);
uint8_t Math::Log10i (uint64_t value);

Description: Compute integer logarithm to base 10.

Parameters:

  • value - value to find its logarithm

Return value:

  • Integer logarithm to base 10 rounded to zero.
  • -1 if value is equal to 0.

Real logarithm to base 10

Cflt32_t Math_Log10_flt32 (flt32_t value);
flt64_t Math_Log10_flt64 (flt64_t value);
flt32v4_t Math_Log10_flt32v4 (flt32v4_t value);
flt64v2_t Math_Log10_flt64v2 (flt64v2_t value);
C++flt32_t Math::Log10 (flt32_t value);
flt64_t Math::Log10 (flt64_t value);
flt32v4_t Math::Log10 (flt32v4_t value);
flt64v2_t Math::Log10 (flt64v2_t value);

Description: Compute logarithm to base 10 of specified value.

Parameters:

  • value - value to find its logarithm

Return value:

  • Logarithm value to base 10.
  • NaN (not a number) if value is less than or equal to 0.
Cflt32_t Math_Log10p1_flt32 (flt32_t value);
flt64_t Math_Log10p1_flt64 (flt64_t value);
flt32v4_t Math_Log10p1_flt32v4 (flt32v4_t value);
flt64v2_t Math_Log10p1_flt64v2 (flt64v2_t value);
C++flt32_t Math::Log10p1 (flt32_t value);
flt64_t Math::Log10p1 (flt64_t value);
flt32v4_t Math::Log10p1 (flt32v4_t value);
flt64v2_t Math::Log10p1 (flt64v2_t value);

Description: Compute logarithm to base 10 of specified value plus 1.

Parameters:

  • value - value to find its logarithm

Return value:

  • Logarithm value to base 10.
  • NaN (not a number) if value is less than or equal to -1.

Logarithm to base E (natural logarithm)

Compute natural logarithm value.

Cflt32_t Math_Log_flt32 (flt32_t value);
flt64_t Math_Log_flt64 (flt64_t value);
flt32v4_t Math_Log_flt32v4 (flt32v4_t value);
flt64v2_t Math_Log_flt64v2 (flt64v2_t value);
C++flt32_t Math::Log (flt32_t value);
flt64_t Math::Log (flt64_t value);
flt32v4_t Math::Log (flt32v4_t value);
flt64v2_t Math::Log (flt64v2_t value);

Description: Compute natural logarithm of specified value.

Parameters:

  • value - value to find its logarithm

Return value:

  • Natural logarithm value.
  • NaN (not a number) if value is less than or equal to 0.
Cflt32_t Math_Logp1_flt32 (flt32_t value);
flt64_t Math_Logp1_flt64 (flt64_t value);
flt32v4_t Math_Logp1_flt32v4 (flt32v4_t value);
flt64v2_t Math_Logp1_flt64v2 (flt64v2_t value);
C++flt32_t Math::Logp1 (flt32_t value);
flt64_t Math::Logp1 (flt64_t value);
flt32v4_t Math::Logp1 (flt32v4_t value);
flt64v2_t Math::Logp1 (flt64v2_t value);

Description: Compute natural logarithm of specified value plus 1.

Parameters:

  • value - value to find its logarithm

Return value:

  • Natural logarithm value.
  • NaN (not a number) if value is less than or equal to -1.

Trigonometric functions

This block of functions provides most popular trigonometric functions are used in typical programs. They use vector extension of newest CPUs and can significantly improve performance of such kind of calculations.

Hypotenuse

Compute 2 dimensional and 3 dimensional hypotenuse by known cathetus.

2 dimensional hypotenuse

Cflt32_t Math_Hypot2D_flt32 (flt32_t cath1, flt32_t cath2);
flt64_t Math_Hypot2D_flt64 (flt64_t cath1, flt64_t cath2);
flt32v4_t Math_Hypot2D_flt32v4 (flt32v4_t cath1, flt32v4_t cath2);
flt64v2_t Math_Hypot2D_flt64v2 (flt64v2_t cath1, flt64v2_t cath2);
C++flt32_t Math::Hypot2D (flt32_t cath1, flt32_t cath2);
flt64_t Math::Hypot2D (flt64_t cath1, flt64_t cath2);
flt32v4_t Math::Hypot2D (flt32v4_t cath1, flt32v4_t cath2);
flt64v2_t Math::Hypot2D (flt64v2_t cath1, flt64v2_t cath2);

Description: Calculate length of 2 dimensional hypotenuse by cathetus values.

Parameters:

  • cath1 - first cathetus
  • cath2 - second cathetus

Return value:

  • Length of hypotenuse.
  • Inf (infinity) if hypotenuse is too big and cannot be represented in selected floating-point type.
  • Subnormal value in case of underflow.
  • 0 (zero) if hypotenuse value can not be represented as subnormal value, or it is equal to zero.

3 dimensional hypotenuse

Cflt32_t Math_Hypot3D_flt32 (flt32_t cath1, flt32_t cath2, flt32_t cath3);
flt64_t Math_Hypot3D_flt64 (flt64_t cath1, flt64_t cath2, flt64_t cath3);
flt32v4_t Math_Hypot3D_flt32v4 (flt32v4_t cath1, flt32v4_t cath2, flt32v4_t cath3);
flt64v2_t Math_Hypot3D_flt64v2 (flt64v2_t cath1, flt64v2_t cath2, flt64v2_t cath3);
C++flt32_t Math::Hypot3D (flt32_t cath1, flt32_t cath2, flt32_t cath3);
flt64_t Math::Hypot3D (flt64_t cath1, flt64_t cath2, flt64_t cath3);
flt32v4_t Math::Hypot3D (flt32v4_t cath1, flt32v4_t cath2, flt32v4_t cath3);
flt64v2_t Math::Hypot3D (flt64v2_t cath1, flt64v2_t cath2, flt64v2_t cath3);

Description: Calculate length of 3 dimensional hypotenuse by cathetus values.

Parameters:

  • cath1 - first cathetus
  • cath2 - second cathetus
  • cath3 - third cathetus

Return value:

  • Length of hypotenuse.
  • Inf (infinity) if hypotenuse is too big and cannot be represented in selected floating-point type.
  • Subnormal value in case of underflow.
  • 0 (zero) if hypotenuse value can not be represented as subnormal value, or it is equal to zero.

Cathetus

Cflt32_t Math_Cath_flt32 (flt32_t hypot, flt32_t cath);
flt64_t Math_Cath_flt64 (flt64_t hypot, flt64_t cath);
flt32v4_t Math_Cath_flt32v4 (flt32v4_t hypot, flt32v4_t cath);
flt64v2_t Math_Cath_flt64v2 (flt64v2_t hypot, flt64v2_t cath);
C++flt32_t Math::Cath (flt32_t hypot, flt32_t cath);
flt64_t Math::Cath (flt64_t hypot, flt64_t cath);
flt32v4_t Math::Cath (flt32v4_t hypot, flt32v4_t cath);
flt64v2_t Math::Cath (flt64v2_t hypot, flt64v2_t cath);

Description: Calculate length of cathetus of a right-angle triangle.

Parameters:

  • hypot - hypotenuse
  • cath - known cathetus

Return value:

  • Length of cathetus.
  • NaN (not a number) if hypotenuse is less than known cathetus.
  • Subnormal value in case of underflow.
  • 0 (zero) if cathetus value can not be represented as subnormal value, or it is equal to zero.

Trigonometric sine

Cflt32_t Math_Sin_flt32 (flt32_t value);
flt64_t Math_Sin_flt64 (flt64_t value);
flt32v4_t Math_Sin_flt32v4 (flt32v4_t value);
flt64v2_t Math_Sin_flt64v2 (flt64v2_t value);
C++flt32_t Math::Sin (flt32_t value);
flt64_t Math::Sin (flt64_t value);
flt32v4_t Math::Sin (flt32v4_t value);
flt64v2_t Math::Sin (flt64v2_t value);

Description: Compute trigonometric sine value for specified angle, given in radians.

Parameters:

  • value - floating-point value representing an angle expressed in radians

Return value:

  • Trigonometric sine value.
  • NaN (not a number) if angle value is out of range (-263,+263) or NaN.

Trigonometric cosine

Cflt32_t Math_Cos_flt32 (flt32_t value);
flt64_t Math_Cos_flt64 (flt64_t value);
flt32v4_t Math_Cos_flt32v4 (flt32v4_t value);
flt64v2_t Math_Cos_flt64v2 (flt64v2_t value);
C++flt32_t Math::Cos (flt32_t value);
flt64_t Math::Cos (flt64_t value);
flt32v4_t Math::Cos (flt32v4_t value);
flt64v2_t Math::Cos (flt64v2_t value);

Description: Compute trigonometric cosine value for specified angle, given in radians.

Parameters:

  • value - floating-point value representing an angle expressed in radians

Return value:

  • Trigonometric cosine value.
  • NaN (not a number) if angle value is out of range (-263,+263) or NaN.

Trigonometric sine and cosine

Cvoid Math_SinCos_flt32 (flt32_t *sin, flt32_t *cos, flt32_t value);
void Math_SinCos_flt64 (flt64_t *sin, flt64_t *cos, flt64_t value);
void Math_SinCos_flt32v4 (flt32v4_t *sin, flt32v4_t *cos, flt32v4_t value);
void Math_SinCos_flt64v2 (flt64v2_t *sin, flt64v2_t *cos, flt64v2_t value);
C++void Math::SinCos (flt32_t *sin, flt32_t *cos, flt32_t value);
void Math::SinCos (flt64_t *sin, flt64_t *cos, flt64_t value);
void Math::SinCos (flt32v4_t *sin, flt32v4_t *cos, flt32v4_t value);
void Math::SinCos (flt64v2_t *sin, flt64v2_t *cos, flt64v2_t value);

Description: Compute trigonometric sine and trigonometric cosine values for specified angle, given in radians.

Parameters:

  • sin - pointer to floating-point variable where to put sine value
  • cos - pointer to floating-point variable where to put cosine value
  • value - floating-point value representing an angle expressed in radians

Return value:

  • Trigonometric sine and cosine values are placed into appropriate variables.
  • NaN (not a number) if angle value is out of range (-263,+263) or NaN.

Trigonometric tangent

Cflt32_t Math_Tan_flt32 (flt32_t value);
flt64_t Math_Tan_flt64 (flt64_t value);
flt32v4_t Math_Tan_flt32v4 (flt32v4_t value);
flt64v2_t Math_Tan_flt64v2 (flt64v2_t value);
C++flt32_t Math::Tan (flt32_t value);
flt64_t Math::Tan (flt64_t value);
flt32v4_t Math::Tan (flt32v4_t value);
flt64v2_t Math::Tan (flt64v2_t value);

Description: Compute trigonometric tangent value for specified angle, given in radians.

Parameters:

  • value - floating-point value representing an angle expressed in radians

Return value:

  • Trigonometric tangent value.
  • NaN (not a number) if angle value is out of range (-263,+263) or NaN.

Inverse trigonometric functions

Inverse trigonometric functions are the inverses of the sine, cosine, and tangent functions. They are used to obtain an angle from any of the angle's trigonometric ratios. Inverse trigonometric functions are widely used in engineering, navigation, physics, and geometry.

Inverse trigonometric sine

Cflt32_t Math_ArcSin_flt32 (flt32_t value);
flt64_t Math_ArcSin_flt64 (flt64_t value);
flt32v4_t Math_ArcSin_flt32v4 (flt32v4_t value);
flt64v2_t Math_ArcSin_flt64v2 (flt64v2_t value);
C++flt32_t Math::ArcSin (flt32_t value);
flt64_t Math::ArcSin (flt64_t value);
flt32v4_t Math::ArcSin (flt32v4_t value);
flt64v2_t Math::ArcSin (flt64v2_t value);

Description: Compute inverse trigonometric sine value.

Parameters:

  • value - trigonometric sine value in range [-1.0,+1.0]

Return value:

  • Value of the inverse trigonometric sine in range [-Pi/2,+Pi/2].
  • NaN (not a number) if value is out of the range or NaN.

Inverse trigonometric cosine

Cflt32_t Math_ArcCos_flt32 (flt32_t value);
flt64_t Math_ArcCos_flt64 (flt64_t value);
flt32v4_t Math_ArcCos_flt32v4 (flt32v4_t value);
flt64v2_t Math_ArcCos_flt64v2 (flt64v2_t value);
C++flt32_t Math::ArcCos (flt32_t value);
flt64_t Math::ArcCos (flt64_t value);
flt32v4_t Math::ArcCos (flt32v4_t value);
flt64v2_t Math::ArcCos (flt64v2_t value);

Description: Compute inverse trigonometric cosine value.

Parameters:

  • value - trigonometric cosine value in range [-1.0,+1.0]

Return value:

  • Value of the inverse trigonometric cosine in range [0,Pi].
  • NaN (not a number) if value is out of the range or NaN.

Inverse trigonometric tangent

Cflt32_t Math_ArcTan_flt32 (flt32_t value);
flt64_t Math_ArcTan_flt64 (flt64_t value);
flt32v4_t Math_ArcTan_flt32v4 (flt32v4_t value);
flt64v2_t Math_ArcTan_flt64v2 (flt64v2_t value);
C++flt32_t Math::ArcTan (flt32_t value);
flt64_t Math::ArcTan (flt64_t value);
flt32v4_t Math::ArcTan (flt32v4_t value);
flt64v2_t Math::ArcTan (flt64v2_t value);

Description: Compute inverse trigonometric tangent value.

Parameters:

  • value - trigonometric tangent value

Return value:

  • Value of the inverse trigonometric tangent in range [-Pi/2,+Pi/2].
  • NaN (not a number) if value is NaN.
Cflt32_t Math_ArcTan2_flt32 (flt32_t sin, flt32_t cos);
flt64_t Math_ArcTan2_flt64 (flt64_t sin, flt64_t cos);
flt32v4_t Math_ArcTan2_flt32v4 (flt32v4_t sin, flt32v4_t cos);
flt64v2_t Math_ArcTan2_flt64v2 (flt64v2_t sin, flt64v2_t cos);
C++flt32_t Math::ArcTan2 (flt32_t sin, flt32_t cos);
flt64_t Math::ArcTan2 (flt64_t sin, flt64_t cos);
flt32v4_t Math::ArcTan2 (flt32v4_t sin, flt32v4_t cos);
flt64v2_t Math::ArcTan2 (flt64v2_t sin, flt64v2_t cos);

Description: Compute inverse trigonometric tangent value, using sine and cosine values.

Parameters:

  • sin - trigonometric sine value
  • cos - trigonometric cosine value

Return value:

  • Value of the inverse trigonometric tangent in range [-Pi,+Pi].
  • NaN (not a number) if sine or cosine value is NaN.

Hyperbolic functions

Hyperbolic functions are analogs of the ordinary trigonometric, or circular, functions. The basic hyperbolic functions are the hyperbolic sine "sinh", and the hyperbolic cosine "cosh", from which is derived the hyperbolic tangent "tanh". The hyperbolic functions take a real argument called a hyperbolic angle. The size of a hyperbolic angle is the area of its hyperbolic sector. The hyperbolic functions may be defined in terms of the legs of a right triangle covering this sector.

Hyperbolic functions occur in the solutions of some important linear differential equations, for example the equation defining a catenary, of some cubic equations, and of Laplace's equation in Cartesian coordinates. The latter is important in many areas of physics, including electromagnetic theory, heat transfer, fluid dynamics, and special relativity.

Hyperbolic sine

Cflt32_t Math_SinH_flt32 (flt32_t value);
flt64_t Math_SinH_flt64 (flt64_t value);
flt32v4_t Math_SinH_flt32v4 (flt32v4_t value);
flt64v2_t Math_SinH_flt64v2 (flt64v2_t value);
C++flt32_t Math::SinH (flt32_t value);
flt64_t Math::SinH (flt64_t value);
flt32v4_t Math::SinH (flt32v4_t value);
flt64v2_t Math::SinH (flt64v2_t value);

Description: Compute hyperbolic sine value for specified angle.

Parameters:

  • value - floating-point value representing a hyperbolic angle

Return value:

  • Hyperbolic sine value.
  • +Inf if value is +Inf.
  • -Inf if value is -Inf.

Hyperbolic cosine

Cflt32_t Math_CosH_flt32 (flt32_t value);
flt64_t Math_CosH_flt64 (flt64_t value);
flt32v4_t Math_CosH_flt32v4 (flt32v4_t value);
flt64v2_t Math_CosH_flt64v2 (flt64v2_t value);
C++flt32_t Math::CosH (flt32_t value);
flt64_t Math::CosH (flt64_t value);
flt32v4_t Math::CosH (flt32v4_t value);
flt64v2_t Math::CosH (flt64v2_t value);

Description: Compute hyperbolic cosine value for specified angle.

Parameters:

  • value - floating-point value representing a hyperbolic angle

Return value:

  • Hyperbolic cosine value.
  • Inf if value is Inf.

Hyperbolic tangent

Cflt32_t Math_TanH_flt32 (flt32_t value);
flt64_t Math_TanH_flt64 (flt64_t value);
flt32v4_t Math_TanH_flt32v4 (flt32v4_t value);
flt64v2_t Math_TanH_flt64v2 (flt64v2_t value);
C++flt32_t Math::TanH (flt32_t value);
flt64_t Math::TanH (flt64_t value);
flt32v4_t Math::TanH (flt32v4_t value);
flt64v2_t Math::TanH (flt64v2_t value);

Description: Compute hyperbolic tangent value for specified angle.

Parameters:

  • value - floating-point value representing a hyperbolic angle

Return value:

  • Hyperbolic tangent value.
  • +1 if value is +Inf.
  • -1 if value is -Inf.

Inverse hyperbolic functions

Inverse hyperbolic functions provide a hyperbolic angle corresponding to a given value of a hyperbolic function. The size of the hyperbolic angle is equal to the area of the corresponding hyperbolic sector of the hyperbola x * y = 1, or twice the area of the corresponding sector of the unit hyperbola x2 − y2 = 1, just as a circular angle is twice the area of the circular sector of the unit circle.

Inverse hyperbolic sine

Cflt32_t Math_ArcSinH_flt32 (flt32_t value);
flt64_t Math_ArcSinH_flt64 (flt64_t value);
flt32v4_t Math_ArcSinH_flt32v4 (flt32v4_t value);
flt64v2_t Math_ArcSinH_flt64v2 (flt64v2_t value);
C++flt32_t Math::ArcSinH (flt32_t value);
flt64_t Math::ArcSinH (flt64_t value);
flt32v4_t Math::ArcSinH (flt32v4_t value);
flt64v2_t Math::ArcSinH (flt64v2_t value);

Description: Compute inverse hyperbolic sine of specified value.

Parameters:

  • value - hyperbolic sine value

Return value:

  • Value of inverse hyperbolic sine.
  • NaN (not a number) if value is NaN.

Inverse hyperbolic cosine

Cflt32_t Math_ArcCosH_flt32 (flt32_t value);
flt64_t Math_ArcCosH_flt64 (flt64_t value);
flt32v4_t Math_ArcCosH_flt32v4 (flt32v4_t value);
flt64v2_t Math_ArcCosH_flt64v2 (flt64v2_t value);
C++flt32_t Math::ArcCosH (flt32_t value);
flt64_t Math::ArcCosH (flt64_t value);
flt32v4_t Math::ArcCosH (flt32v4_t value);
flt64v2_t Math::ArcCosH (flt64v2_t value);

Description: Compute inverse hyperbolic cosine of specified value.

Parameters:

  • value - hyperbolic cosine value

Return value:

  • Value of inverse hyperbolic cosine.
  • NaN (not a number) if value is less than 1.0 or NaN.

Inverse hyperbolic tangent

Cflt32_t Math_ArcTanH_flt32 (flt32_t value);
flt64_t Math_ArcTanH_flt64 (flt64_t value);
flt32v4_t Math_ArcTanH_flt32v4 (flt32v4_t value);
flt64v2_t Math_ArcTanH_flt64v2 (flt64v2_t value);
C++flt32_t Math::ArcTanH (flt32_t value);
flt64_t Math::ArcTanH (flt64_t value);
flt32v4_t Math::ArcTanH (flt32v4_t value);
flt64v2_t Math::ArcTanH (flt64v2_t value);

Description: Compute inverse hyperbolic tangent of specified value.

Parameters:

  • value - hyperbolic tangent value in range [-1,+1]

Return value:

  • Value of inverse hyperbolic tangent.
  • NaN (not a number) if value is out of the range or NaN.

Rounding

These functions round their argument to nearest integer value in floating point format according to required rounding mode.

Round down (floor)

Cflt32_t Math_RoundDown_flt32 (flt32_t value);
flt64_t Math_RoundDown_flt64 (flt64_t value);
flt32v4_t Math_RoundDown_flt32v4 (flt32v4_t value);
flt64v2_t Math_RoundDown_flt64v2 (flt64v2_t value);
C++flt32_t Math::RoundDown (flt32_t value);
flt64_t Math::RoundDown (flt64_t value);
flt32v4_t Math::RoundDown (flt32v4_t value);
flt64v2_t Math::RoundDown (flt64v2_t value);

Description: Round specified argument to an integer value in floating-point format, using round down (floor) mode.

Parameters:

  • value - value to round

Return value:

  • Value rounded down to minus infinity.
  • NaN (not a number) if value is NaN.

Round up (ceil)

Cflt32_t Math_RoundUp_flt32 (flt32_t value);
flt64_t Math_RoundUp_flt64 (flt64_t value);
flt32v4_t Math_RoundUp_flt32v4 (flt32v4_t value);
flt64v2_t Math_RoundUp_flt64v2 (flt64v2_t value);
C++flt32_t Math::RoundUp (flt32_t value);
flt64_t Math::RoundUp (flt64_t value);
flt32v4_t Math::RoundUp (flt32v4_t value);
flt64v2_t Math::RoundUp (flt64v2_t value);

Description: Round specified argument to an integer value in floating-point format, using round up (ceil) mode.

Parameters:

  • value - value to round

Return value:

  • Value rounded up to plus infinity.
  • NaN (not a number) if value is NaN.

Round to nearest even integer

Cflt32_t Math_RoundInt_flt32 (flt32_t value);
flt64_t Math_RoundInt_flt64 (flt64_t value);
flt32v4_t Math_RoundInt_flt32v4 (flt32v4_t value);
flt64v2_t Math_RoundInt_flt64v2 (flt64v2_t value);
C++flt32_t Math::RoundInt (flt32_t value);
flt64_t Math::RoundInt (flt64_t value);
flt32v4_t Math::RoundInt (flt32v4_t value);
flt64v2_t Math::RoundInt (flt64v2_t value);

Description: Round specified argument to an integer value in floating-point format, using round to nearest even integer mode.

Parameters:

  • value - value to round

Return value:

  • Value rounded to nearest even integer.
  • NaN (not a number) if value is NaN.

Round to nearest integer, away from zero

Cflt32_t Math_Round_flt32 (flt32_t value);
flt64_t Math_Round_flt64 (flt64_t value);
flt32v4_t Math_Round_flt32v4 (flt32v4_t value);
flt64v2_t Math_Round_flt64v2 (flt64v2_t value);
C++flt32_t Math::Round (flt32_t value);
flt64_t Math::Round (flt64_t value);
flt32v4_t Math::Round (flt32v4_t value);
flt64v2_t Math::Round (flt64v2_t value);

Description: Round specified argument to an integer value in floating-point format, using round to nearest integer, away from zero mode.

Parameters:

  • value - value to round

Return value:

  • Value rounded to nearest integer, away from zero.
  • NaN (not a number) if value is NaN.

Round to nearest integer, toward zero (truncation)

Cflt32_t Math_Truncate_flt32 (flt32_t value);
flt64_t Math_Truncate_flt64 (flt64_t value);
flt32v4_t Math_Truncate_flt32v4 (flt32v4_t value);
flt64v2_t Math_Truncate_flt64v2 (flt64v2_t value);
C++flt32_t Math::Truncate (flt32_t value);
flt64_t Math::Truncate (flt64_t value);
flt32v4_t Math::Truncate (flt32v4_t value);
flt64v2_t Math::Truncate (flt64v2_t value);

Description: Round specified argument to an integer value in floating-point format, using round to nearest integer, toward zero (truncation) mode.

Parameters:

  • value - value to round

Return value:

  • Value truncated to zero.
  • NaN (not a number) if value is NaN.

Fractional part

Cflt32_t Math_Frac_flt32 (flt32_t value);
flt64_t Math_Frac_flt64 (flt64_t value);
flt32v4_t Math_Frac_flt32v4 (flt32v4_t value);
flt64v2_t Math_Frac_flt64v2 (flt64v2_t value);
C++flt32_t Math::Frac (flt32_t value);
flt64_t Math::Frac (flt64_t value);
flt32v4_t Math::Frac (flt32v4_t value);
flt64v2_t Math::Frac (flt64v2_t value);

Description: Return fractional part of floating-point value, preserving sign of original number.

Parameters:

  • value - value to round

Return value:

  • Fractional part of floating-point value with correct sign.
  • NaN (not a number) if value is NaN.

Checks

These functions check floating-point variables for special values, and return result as bool variable, which shows check status.

Check for normal value

Cbool Math_IsNormal_flt32 (flt32_t value);
bool Math_IsNormal_flt64 (flt64_t value);
C++bool Math::IsNormal (flt32_t value);
bool Math::IsNormal (flt64_t value);

Description: Check if variable is normal floating-point value.

Parameters:

  • value - value to check

Return value:

  • TRUE (1) if variable is normal floating-point value.
  • FALSE (0) if variable is not normal floating-point value.

Check for subnormal value

Cbool Math_IsSubnormal_flt32 (flt32_t value);
bool Math_IsSubnormal_flt64 (flt64_t value);
C++bool Math::IsSubnormal (flt32_t value);
bool Math::IsSubnormal (flt64_t value);

Description: Check if variable is subnormal floating-point value.

Parameters:

  • value - value to check

Return value:

  • TRUE (1) if variable is subnormal floating-point value.
  • FALSE (0) if variable is not subnormal floating-point value.

Check for finite value

Cbool Math_IsFinite_flt32 (flt32_t value);
bool Math_IsFinite_flt64 (flt64_t value);
C++bool Math::IsFinite (flt32_t value);
bool Math::IsFinite (flt64_t value);

Description: Check if variable is finite floating-point value.

Parameters:

  • value - value to check

Return value:

  • TRUE (1) if variable is finite floating-point value.
  • FALSE (0) if variable is not finite floating-point value.

Check for infinite value

Cbool Math_IsInfinite_flt32 (flt32_t value);
bool Math_IsInfinite_flt64 (flt64_t value);
C++bool Math::IsInfinite (flt32_t value);
bool Math::IsInfinite (flt64_t value);

Description: Check if variable is infinite floating-point value.

Parameters:

  • value - value to check

Return value:

  • TRUE (1) if variable is infinite floating-point value.
  • FALSE (0) if variable is not infinite floating-point value.

Check for NaN value

Cbool Math_IsNaN_flt32 (flt32_t value);
bool Math_IsNaN_flt64 (flt64_t value);
C++bool Math::IsNaN (flt32_t value);
bool Math::IsNaN (flt64_t value);

Description: Check if variable is NaN value.

Parameters:

  • value - value to check

Return value:

  • TRUE (1) if variable is NaN value.
  • FALSE (0) if variable is not NaN value.
Copyright 2012-2018 Jack Black. All rights reserved.