Tuesday
Functions
<tue/math.hpp>

Detailed Description

Global math functions for basic scalar types.

The allowable types are restricted to those which can be used as SIMD components.

Functions

template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value, T > tue::math::sin (T x) noexcept
 Computes the sine of x (measured in radians). More...
 
template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value, T > tue::math::cos (T x) noexcept
 Computes the cosine of x (measured in radians). More...
 
template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value > tue::math::sincos (T x, T &sin_out, T &cos_out) noexcept
 Computes the sine and cosine of x (measured in radians). More...
 
template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value, T > tue::math::exp (T x) noexcept
 Computes the base-e exponential of x. More...
 
template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value, T > tue::math::log (T x) noexcept
 Computes the base-e (natural) logarithm of x. More...
 
template<typename T >
std::enable_if_t< is_arithmetic_simd_component< T >::value, T > tue::math::abs (T x) noexcept
 Computes the absolute value of x. More...
 
template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value, T > tue::math::pow (T x, T y) noexcept
 Computes x raised to the power y. More...
 
template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value, T > tue::math::recip (T x) noexcept
 Computes the reciprocal of x. More...
 
template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value, T > tue::math::sqrt (T x) noexcept
 Computes the nonnegative square root of x. More...
 
template<typename T >
std::enable_if_t< is_floating_point_simd_component< T >::value, T > tue::math::rsqrt (T x) noexcept
 Computes the reciprocal of the nonnegative square root of x. More...
 
template<typename T >
std::enable_if_t< is_arithmetic_simd_component< T >::value, T > tue::math::min (T x, T y) noexcept
 Determines the minimum numeric value of the arguments. More...
 
template<typename T >
std::enable_if_t< is_arithmetic_simd_component< T >::value, T > tue::math::max (T x, T y) noexcept
 Determines the maximum numeric value of the arguments. More...
 
template<typename T , typename U >
std::enable_if_t< is_sized_bool< T >::value &&is_simd_component< U >::value &&sizeof(T)==sizeof(U), U > tue::math::mask (T condition, U value) noexcept
 Computes the bitwise AND of condition and value. More...
 
template<typename T , typename U >
std::enable_if_t< is_sized_bool< T >::value &&is_simd_component< U >::value &&sizeof(T)==sizeof(U), U > tue::math::select (T condition, U value, U otherwise) noexcept
 Selects a return value based on condition. More...
 
template<typename T >
std::enable_if_t< is_arithmetic_simd_component< T >::value, sized_bool_t< sizeof(T)> > tue::math::less (T lhs, T rhs) noexcept
 Computes whether or not lhs is less than rhs. More...
 
template<typename T >
std::enable_if_t< is_arithmetic_simd_component< T >::value, sized_bool_t< sizeof(T)> > tue::math::less_equal (T lhs, T rhs) noexcept
 Computes whether or not lhs is less than or equal to rhs. More...
 
template<typename T >
std::enable_if_t< is_arithmetic_simd_component< T >::value, sized_bool_t< sizeof(T)> > tue::math::greater (T lhs, T rhs) noexcept
 Computes whether or not lhs is greater than rhs. More...
 
template<typename T >
std::enable_if_t< is_arithmetic_simd_component< T >::value, sized_bool_t< sizeof(T)> > tue::math::greater_equal (T lhs, T rhs) noexcept
 Computes whether or not lhs is greater than or equal to rhs. More...
 
template<typename T >
std::enable_if_t< is_simd_component< T >::value, sized_bool_t< sizeof(T)> > tue::math::equal (T lhs, T rhs) noexcept
 Computes whether or not lhs is equal to rhs. More...
 
template<typename T >
std::enable_if_t< is_simd_component< T >::value, sized_bool_t< sizeof(T)> > tue::math::not_equal (T lhs, T rhs) noexcept
 Computes whether or not lhs is not equal to rhs. More...
 

Function Documentation

template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value, T> tue::math::sin ( x)
inlinenoexcept

Computes the sine of x (measured in radians).

Template Parameters
TThe type of parameter x.
Parameters
xA floating-point number.
Returns
The sine of x (measured in radians).
template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value, T> tue::math::cos ( x)
inlinenoexcept

Computes the cosine of x (measured in radians).

Template Parameters
TThe type of parameter x.
Parameters
xA floating-point number.
Returns
The cosine of x (measured in radians).
template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value> tue::math::sincos ( x,
T &  sin_out,
T &  cos_out 
)
inlinenoexcept

Computes the sine and cosine of x (measured in radians).

Template Parameters
TThe type of parameter x.
Parameters
xA floating-point number.
sin_outA reference to the value where the sine of x (measured in radians) will be stored.
cos_outA reference to the value where the cosine of x (measured in radians) will be stored.
template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value, T> tue::math::exp ( x)
inlinenoexcept

Computes the base-e exponential of x.

Template Parameters
TThe type of parameter x.
Parameters
xA floating-point number.
Returns
The base-e exponential of x.
template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value, T> tue::math::log ( x)
inlinenoexcept

Computes the base-e (natural) logarithm of x.

If x is negative, behavior is undefined.

Template Parameters
TThe type of parameter x.
Parameters
xA floating-point number.
Returns
The base-e (natural) logarithm of x.
template<typename T >
std::enable_if_t<is_arithmetic_simd_component<T>::value, T> tue::math::abs ( x)
inlinenoexcept

Computes the absolute value of x.

Template Parameters
TThe type of parameter x.
Parameters
xA number.
Returns
The absolute value of x.
template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value, T> tue::math::pow ( x,
y 
)
inlinenoexcept

Computes x raised to the power y.

If x is negative, behavior is undefined.

Template Parameters
TThe type of parameters x and y.
Parameters
xA floating-point number.
yAnother floating-point number.
Returns
x raised to the power y.
template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value, T> tue::math::recip ( x)
inlinenoexcept

Computes the reciprocal of x.

If x equals 0, behavior is undefined.

Template Parameters
TThe type of parameter x.
Parameters
xA floating-point number.
Returns
The reciprocal of x.
template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value, T> tue::math::sqrt ( x)
inlinenoexcept

Computes the nonnegative square root of x.

If x is negative, behavior is undefined.

Template Parameters
TThe type of parameter x.
Parameters
xA floating-point number.
Returns
The nonnegative square root of x.
template<typename T >
std::enable_if_t<is_floating_point_simd_component<T>::value, T> tue::math::rsqrt ( x)
inlinenoexcept

Computes the reciprocal of the nonnegative square root of x.

If x is less than or equal to 0, behavior is undefined.

Template Parameters
TThe type of parameter x.
Parameters
xA floating-point number.
Returns
The reciprocal of the nonnegative square root of x.
template<typename T >
std::enable_if_t<is_arithmetic_simd_component<T>::value, T> tue::math::min ( x,
y 
)
inlinenoexcept

Determines the minimum numeric value of the arguments.

Template Parameters
TThe type of parameters x and y.
Parameters
xA number.
yAnother number.
Returns
The minimum numeric value of the arguments.
template<typename T >
std::enable_if_t<is_arithmetic_simd_component<T>::value, T> tue::math::max ( x,
y 
)
inlinenoexcept

Determines the maximum numeric value of the arguments.

Template Parameters
TThe type of parameters x and y.
Parameters
xA number.
yAnother number.
Returns
The maximum numeric value of the arguments.
template<typename T , typename U >
std::enable_if_t< is_sized_bool<T>::value && is_simd_component<U>::value && sizeof(T) == sizeof(U), U> tue::math::mask ( condition,
value 
)
inlinenoexcept

Computes the bitwise AND of condition and value.

Template Parameters
TThe condition type.
UThe return type.
Parameters
conditionThe condition.
valueThe return value when condition is trueX (where X is the number of bits in T).
Returns
value or 0 depending on condition.
template<typename T , typename U >
std::enable_if_t< is_sized_bool<T>::value && is_simd_component<U>::value && sizeof(T) == sizeof(U), U> tue::math::select ( condition,
value,
otherwise 
)
inlinenoexcept

Selects a return value based on condition.

Template Parameters
TThe condition type.
UThe return type.
Parameters
conditionThe condition.
valueThe return value when condition is trueX (where X is the number of bits in T).
otherwiseThe return value when condition is falseX (where X is the number of bits in T).
Returns
value or otherwise depending on condition.
template<typename T >
std::enable_if_t< is_arithmetic_simd_component<T>::value, sized_bool_t<sizeof(T)> > tue::math::less ( lhs,
rhs 
)
inlinenoexcept

Computes whether or not lhs is less than rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
trueX if lhs is less than rhs and falseX otherwise (where X is the number of bits in T).
template<typename T >
std::enable_if_t< is_arithmetic_simd_component<T>::value, sized_bool_t<sizeof(T)> > tue::math::less_equal ( lhs,
rhs 
)
inlinenoexcept

Computes whether or not lhs is less than or equal to rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
trueX if lhs is less than or equal to rhs and falseX otherwise (where X is the number of bits in T).
template<typename T >
std::enable_if_t< is_arithmetic_simd_component<T>::value, sized_bool_t<sizeof(T)> > tue::math::greater ( lhs,
rhs 
)
inlinenoexcept

Computes whether or not lhs is greater than rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
trueX if lhs is greater than rhs and falseX otherwise (where X is the number of bits in T).
template<typename T >
std::enable_if_t< is_arithmetic_simd_component<T>::value, sized_bool_t<sizeof(T)> > tue::math::greater_equal ( lhs,
rhs 
)
inlinenoexcept

Computes whether or not lhs is greater than or equal to rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
trueX if lhs is greater than or equal to rhs and falseX otherwise (where X is the number of bits in T).
template<typename T >
std::enable_if_t< is_simd_component<T>::value, sized_bool_t<sizeof(T)> > tue::math::equal ( lhs,
rhs 
)
inlinenoexcept

Computes whether or not lhs is equal to rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
trueX if lhs is equal to rhs and falseX otherwise (where X is the number of bits in T).
template<typename T >
std::enable_if_t< is_simd_component<T>::value, sized_bool_t<sizeof(T)> > tue::math::not_equal ( lhs,
rhs 
)
inlinenoexcept

Computes whether or not lhs is not equal to rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
trueX if lhs is not equal to rhs and falseX otherwise (where X is the number of bits in T).