Om  1.0.0
A universal framework for multimedia simulation
Namespaces | Functions
omScalarMath.h File Reference
#include "omMathConfig.h"

Namespaces

 om
 The enclosing namespace for the entire Om library.
 
 om::math
 A namespace containing classes and functions that do fast math operations.
 
 om::math::detail
 

Functions

template<typename T >
om::math::pi ()
 
template<typename T >
om::math::e ()
 
template<typename T >
om::math::nan ()
 Return the Not-A-Number representation for the templated type, or zero if it has none. More...
 
template<typename T >
om::math::infinity ()
 Return the Infinity representation for the templated type, or the maximum value if it has none. More...
 
template<typename T >
om::math::negativeInfinity ()
 Return the Negative Infinity representation for the templated type, or the minimum value if it has none. More...
 
template<>
unsigned char om::math::negativeInfinity< unsigned char > ()
 Return the Negative Infinity representation for the templated type, or the minimum value if it has none. More...
 
template<>
unsigned short om::math::negativeInfinity< unsigned short > ()
 Return the Negative Infinity representation for the templated type, or the minimum value if it has none. More...
 
template<>
unsigned int om::math::negativeInfinity< unsigned int > ()
 Return the Negative Infinity representation for the templated type, or the minimum value if it has none. More...
 
template<>
unsigned long om::math::negativeInfinity< unsigned long > ()
 Return the Negative Infinity representation for the templated type, or the minimum value if it has none. More...
 
template<>
unsigned long long om::math::negativeInfinity< unsigned long long > ()
 Return the Negative Infinity representation for the templated type, or the minimum value if it has none. More...
 
template<typename T >
om::math::max ()
 Return the maximum allowable finite value for the template parameter type. More...
 
template<typename T >
om::math::min ()
 Return the minimum allowable finite value for the template parameter type. More...
 
template<>
float om::math::min< float > ()
 Return the minimum allowable finite value for the template parameter type. More...
 
template<>
double om::math::min< double > ()
 Return the minimum allowable finite value for the template parameter type. More...
 
template<typename T >
om::math::minPositive ()
 Return the smallest normalized positive value for the template parameter type. More...
 
template<typename T >
om::math::epsilon ()
 Return the smallest deviation from the value 1 that the templated type can represent. More...
 
template<>
float om::math::epsilon ()
 Return the smallest deviation from the value 1 that a float can represent. More...
 
template<>
double om::math::epsilon ()
 Return the smallest deviation from the value 1 that a double can represent. More...
 
template<typename T >
bool om::math::isInfinity (T number)
 Return whether a number is equal to the representation of Infinity for its type. More...
 
template<typename T >
bool om::math::isNegativeInfinity (T number)
 Return whether a number is equal to the representation of Negative Infinity for its type. More...
 
template<>
bool om::math::isNegativeInfinity (unsigned char number)
 
template<>
bool om::math::isNegativeInfinity (unsigned short number)
 
template<>
bool om::math::isNegativeInfinity (unsigned int number)
 
template<>
bool om::math::isNegativeInfinity (unsigned long number)
 
template<>
bool om::math::isNegativeInfinity (unsigned long long number)
 
template<typename T >
bool om::math::isInfinite (T number)
 Return whether a number is equal to Negative or Positive Infinity for its type. More...
 
template<typename T >
bool om::math::isFinite (T number)
 Return whether a number is finite. More...
 
template<typename T >
bool om::math::isNAN (T number)
 Return whether or not the specified number is Not-A-Number. More...
 
template<>
bool om::math::isNAN (float number)
 
template<>
bool om::math::isNAN (double number)
 
template<typename T >
bool om::math::isInteger ()
 
template<>
bool om::math::isInteger< char > ()
 
template<>
bool om::math::isInteger< unsigned char > ()
 
template<>
bool om::math::isInteger< short > ()
 
template<>
bool om::math::isInteger< unsigned short > ()
 
template<>
bool om::math::isInteger< int > ()
 
template<>
bool om::math::isInteger< unsigned int > ()
 
template<>
bool om::math::isInteger< long > ()
 
template<>
bool om::math::isInteger< unsigned long > ()
 
template<>
bool om::math::isInteger< long long > ()
 
template<>
bool om::math::isInteger< unsigned long long > ()
 
template<typename T >
bool om::math::isInteger (T number)
 
template<typename T >
bool om::math::isFloatingPoint ()
 
template<>
bool om::math::isFloatingPoint< float > ()
 
template<>
bool om::math::isFloatingPoint< double > ()
 
template<typename T >
bool om::math::isFloatingPoint (T number)
 
template<typename T >
om::math::abs (T number)
 Return the absolute value of the specified number, such that the result is positive. More...
 
template<>
float om::math::abs (float number)
 
template<>
double om::math::abs (double number)
 
template<>
unsigned char om::math::abs (unsigned char value)
 
template<>
unsigned short om::math::abs (unsigned short value)
 
template<>
unsigned int om::math::abs (unsigned int value)
 
template<>
unsigned long om::math::abs (unsigned long value)
 
template<>
unsigned long long om::math::abs (unsigned long long value)
 
template<typename T >
om::math::sign (T number)
 Return -1 if the number is less than zero, 0 if it is zero, and 1 otherwise. More...
 
template<>
unsigned char om::math::sign (unsigned char value)
 
template<>
unsigned short om::math::sign (unsigned short value)
 
template<>
unsigned int om::math::sign (unsigned int value)
 
template<>
unsigned long om::math::sign (unsigned long value)
 
template<>
unsigned long long om::math::sign (unsigned long long value)
 
template<typename T >
bool om::math::equals (T value1, T value2)
 
template<>
bool om::math::equals (float value1, float value2)
 
template<>
bool om::math::equals (double value1, double value2)
 
template<typename T >
bool om::math::fuzzyEquals (T value1, T value2, T epsilon)
 
template<typename T >
bool om::math::isZero (T value, T epsilon)
 
template<typename T >
bool om::math::isZero (T value)
 
template<>
bool om::math::isZero (float value)
 
template<>
bool om::math::isZero (double value)
 
template<typename T >
om::math::average (T value1, T value2)
 
template<>
float om::math::average (float value1, float value2)
 
template<>
double om::math::average (double value1, double value2)
 
template<typename T >
om::math::max (T value1, T value2)
 Return the larger of two numbers. More...
 
template<typename T >
om::math::min (T value1, T value2)
 Return the smaller of two numbers. More...
 
template<typename T >
om::math::clamp (T number, T minimum, T maximum)
 Return the result when the a number is constrainted to the interval [minimum, maximum]. More...
 
template<typename T >
om::math::floor (T number)
 Return the largest whole number smaller than the number parameter, as the same type. More...
 
template<>
float om::math::floor (float number)
 
template<>
double om::math::floor (double number)
 
template<typename T >
om::math::ceiling (T number)
 
template<>
float om::math::ceiling (float number)
 
template<>
double om::math::ceiling (double number)
 
template<typename T >
om::math::round (T value)
 
template<>
float om::math::round (float value)
 
template<>
double om::math::round (double value)
 
template<typename T >
om::math::detail::recursiveSquareRoot (T n, T x1)
 
template<typename T >
om::math::sqrti (T value)
 
template<typename T >
om::math::sqrt (T value)
 
template<>
float om::math::sqrt (float value)
 
template<>
double om::math::sqrt (double value)
 
template<typename T >
om::math::previousMultiple (T number, T base)
 Get the previous multiple of a base that is less than or equal to a specified number. More...
 
template<typename T >
om::math::nextMultiple (T number, T base)
 Get the next multiple of a base that is greater than or equal to a specified number. More...
 
template<typename T >
om::math::nearestMultiple (T number, T base)
 Get the multiple of a base that the closest to a specified number. More...
 
template<typename T >
om::math::nextPowerOfTwo (T x)
 Return the first power of two larger than the specified number. More...
 
template<>
char om::math::nextPowerOfTwo (char x)
 Return the first power of two larger than the specified number. More...
 
template<>
unsigned char om::math::nextPowerOfTwo (unsigned char x)
 Return the first power of two larger than the specified number. More...
 
template<>
short om::math::nextPowerOfTwo (short x)
 Return the first power of two larger than the specified number. More...
 
template<>
unsigned short om::math::nextPowerOfTwo (unsigned short x)
 Return the first power of two larger than the specified number. More...
 
template<>
int om::math::nextPowerOfTwo (int x)
 Return the first power of two larger than the specified number. More...
 
template<>
unsigned int om::math::nextPowerOfTwo (unsigned int x)
 Return the first power of two larger than the specified number. More...
 
template<>
long om::math::nextPowerOfTwo (long x)
 Return the first power of two larger than the specified number. More...
 
template<>
unsigned long om::math::nextPowerOfTwo (unsigned long x)
 Return the first power of two larger than the specified number. More...
 
template<>
long long om::math::nextPowerOfTwo (long long x)
 Return the first power of two larger than the specified number. More...
 
template<>
unsigned long long om::math::nextPowerOfTwo (unsigned long long x)
 Return the first power of two larger than the specified number. More...
 
template<typename T >
Bool om::math::isPowerOfTwo (T number)
 Return whether or not the specified number is a power of 2. More...
 
template<typename T >
bool om::math::detail::multWillOverflow (T a, T b)
 
template<typename T >
bool om::math::detail::unsignedMultWillOverflow (T a, T b)
 
template<typename IntegerType >
IntegerType om::math::detail::integerPower (IntegerType base, IntegerType power)
 
template<typename IntegerType >
IntegerType om::math::detail::unsignedIntegerPower (IntegerType base, IntegerType power)
 
template<typename T , typename U >
om::math::pow (T base, U power)
 
template<>
char om::math::pow (char base, char power)
 
template<>
unsigned char om::math::pow (unsigned char base, unsigned char power)
 
template<>
short om::math::pow (short base, short power)
 
template<>
unsigned short om::math::pow (unsigned short base, unsigned short power)
 
template<>
int om::math::pow (int base, int power)
 
template<>
unsigned int om::math::pow (unsigned int base, unsigned int power)
 
template<>
long om::math::pow (long base, long power)
 
template<>
unsigned long om::math::pow (unsigned long base, unsigned long power)
 
template<>
long long om::math::pow (long long base, long long power)
 
template<>
unsigned long long om::math::pow (unsigned long long base, unsigned long long power)
 
template<typename T >
om::math::square (T value)
 
template<typename T >
om::math::ln (T value)
 
template<typename T >
om::math::log10 (T value)
 
template<typename T , T base>
om::math::detail::intLog (T value)
 
template<>
short om::math::log10 (short value)
 
template<>
unsigned short om::math::log10 (unsigned short value)
 
template<>
int om::math::log10 (int value)
 
template<>
unsigned int om::math::log10 (unsigned int value)
 
template<>
long om::math::log10 (long value)
 
template<>
unsigned long om::math::log10 (unsigned long value)
 
template<>
long long om::math::log10 (long long value)
 
template<>
unsigned long long om::math::log10 (unsigned long long value)
 
template<typename T >
om::math::log (T value, T base)
 
template<>
float om::math::log (float value, float base)
 
template<typename T >
om::math::log2 (T value)
 
template<>
float om::math::log2 (float value)
 
template<>
double om::math::log2 (double value)
 
template<typename T >
om::math::bitCount (T bits)
 
template<>
UInt32 om::math::bitCount (UInt32 bits)
 
template<>
UInt64 om::math::bitCount (UInt64 bits)
 
template<typename T >
om::math::firstSetBit (T bits)
 
template<>
UInt32 om::math::firstSetBit (UInt32 bits)
 
template<>
UInt64 om::math::firstSetBit (UInt64 bits)
 
template<typename T >
om::math::lastSetBit (T bits)
 
template<>
UInt32 om::math::lastSetBit (UInt32 bits)
 
template<>
UInt64 om::math::lastSetBit (UInt64 bits)
 
template<typename T >
om::math::mod (T value, T divisor)
 Compute the remainder when the specified value is divided by the given divisor. More...
 
template<>
float om::math::mod (float value, float divisor)
 Compute the remainder when the specified value is divided by the given divisor. More...
 
template<>
double om::math::mod (double value, double divisor)
 Compute the remainder when the specified value is divided by the given divisor. More...
 
float om::math::radiansToDegrees (float number)
 
double om::math::radiansToDegrees (double number)
 
float om::math::degreesToRadians (float number)
 
double om::math::degreesToRadians (double number)
 
template<typename T >
om::math::linearToDB (T linear)
 Convert the specfied linear ratio to a logarithmic ratio in decibels. More...
 
template<typename T >
om::math::dbToLinear (T db)
 Convert the specfied logarithmic ratio in decibels to a linear ratio. More...
 
template<typename T >
om::math::sec (T value)
 Compute and return the secant of the specified value. More...
 
template<typename T >
om::math::csc (T value)
 Compute and return the cosecant of the specified value. More...
 
template<typename T >
om::math::cot (T value)
 Compute and return the cotangent of the specified value. More...
 
template<typename T >
om::math::sech (T value)
 Compute and return the secant of the specified value. More...
 
template<typename T >
om::math::csch (T value)
 Compute and return the cosecant of the specified value. More...
 
template<typename T >
om::math::coth (T value)
 Compute and return the cotangent of the specified value. More...
 
template<typename T >
om::math::asinh (T value)
 Compute and return the inverse hyperbolic sine of the specified value. More...
 
template<typename T >
om::math::acosh (T value)
 Compute and return the inverse hyperbolic cosine of the specified value. More...
 
template<typename T >
om::math::atanh (T value)
 Compute and return the inverse hyperbolic tangent of the specified value. More...
 
template<typename T >
om::math::asech (T value)
 Compute and return the inverse hyperbolic secant of the specified value. More...
 
template<typename T >
om::math::acsch (T value)
 Compute and return the inverse hyperbolic cosecant of the specified value. More...
 
template<typename T >
om::math::acoth (T value)
 Compute and return the inverse hyperbolic cotangent of the specified value. More...