Scalar math and comparisons
abs, clamp and linear interpolation of numbers, and comparisons with a tolerance.
Transform 1
Compute 13
abs
11 overloadsfloat abs(float a)sourceAbsolute value of a float (std::abs).
double abs(double a)sourceAbsolute value of a double (std::abs).
char abs(char a)sourceAbsolute value of a signed char.
short abs(short a)sourceAbsolute value of a signed short.
int abs(int a)sourceAbsolute value of a signed int.
long abs(long a)sourceAbsolute value of a signed long.
long long abs(long long a)sourceAbsolute value of a signed long long.
unsigned char abs(unsigned char a)sourceAbsolute value of an unsigned integer, i.e. the value itself.
unsigned short abs(unsigned short a)sourceAbsolute value of an unsigned integer, i.e. the value itself.
unsigned int abs(unsigned int a)sourceAbsolute value of an unsigned integer, i.e. the value itself.
unsigned long abs(unsigned long a)sourceAbsolute value of an unsigned integer, i.e. the value itself.
template <typename T1, typename T2>
T1 clamp(T1 x, T2 x_min, T2 x_max)Clamps x to the interval [x_min, x_max].
template <typename T>
T interpolation_linear(float alpha, T const& value_0, T const& value_1)Linear interpolation (1-alpha)*value_0 + alpha*value_1, with alpha expected in [0,1].
Access 10
is_equal
10 overloadsbool is_equal(float a, float b)sourceApproximate equality of two floats: true if |a-b| <= 1e-5.
bool is_equal(double a, double b)sourceApproximate equality of two doubles: true if |a-b| <= 1e-7.
bool is_equal(float a, double b)sourceApproximate equality of a float and a double, compared in float precision with tolerance 1e-5.
bool is_equal(double a, float b)sourceApproximate equality of a double and a float, compared in float precision with tolerance 1e-5.
template <typename T1, typename T2>
bool is_equal(T1 const& a, T2 const& b)sourceGeneric fallback equality test using operator== (exact comparison).
template <typename T1, typename T2, size_t N>
bool is_equal(std::array<T1,N> const& a, std::array<T2,N> const& b)sourceElement-wise equality of two std::array, approximate for floating-point elements.
template <typename T1, typename T2>
bool is_equal(std::vector<T1> const& a, std::vector<T2> const& b)sourceElement-wise equality of two std::vector, approximate for floating-point elements; false if sizes differ.
bool is_equal(std::string const& a, std::string const& b)sourceExact equality of two strings.
bool is_equal(std::string const& a, char const* b)sourceExact equality of a string and a C-string.
bool is_equal(char const* a, std::string const& b)sourceExact equality of a C-string and a string.