commonlib
MathFuncs Class Reference

The class implements helper functions for mathematical operations. More...

#include <mathfuncs.h>

Static Public Member Functions

template<typename T >
static bool inRange (T input, T minimum, T maximum)
 Indicates whether a value falls within a specified range. More...
 
template<typename T >
static T ensureRange (T input, T minimum, T maximum)
 Function returns a value that is guaranteed to be within a specified range. More...
 
template<typename T >
static bool areSame (T first, T second, T epsilon=(T) std::numeric_limits< T >::epsilon())
 Function checks if two values are the same within data types limitation. More...
 
template<typename T >
static bool isZero (T input, T epsilon=(T) std::numeric_limits< T >::epsilon())
 Function checks if value is zero. More...
 
template<typename T >
static T gcd (T first, T second)
 Function returns greatest common divisor for two values. More...
 
template<typename T >
static T lcm (T first, T second)
 Function returns lowest common multiple for for two values. More...
 

Detailed Description

The class implements helper functions for mathematical operations.

Member Function Documentation

◆ areSame()

template<typename T >
bool MathFuncs::areSame ( T  first,
T  second,
T  epsilon = (T) std::numeric_limits<T>::epsilon() 
)
static

Function checks if two values are the same within data types limitation.

Parameters
firstvalue
secondvalue
limit
Returns
function returns true is values are the same

◆ ensureRange()

template<typename T >
T MathFuncs::ensureRange ( T  input,
T  minimum,
T  maximum 
)
static

Function returns a value that is guaranteed to be within a specified range.

Parameters
inputvalue
minimumvalue
maximumvalue
Returns
function returns a value that is guaranteed to be within a specified range

◆ gcd()

template<typename T >
T MathFuncs::gcd ( T  first,
T  second 
)
static

Function returns greatest common divisor for two values.

Parameters
firstvalue
secondvalue
Returns
function returns greatest common divisor

◆ inRange()

template<typename T >
bool MathFuncs::inRange ( T  input,
T  minimum,
T  maximum 
)
static

Indicates whether a value falls within a specified range.

Parameters
inputvalue
minimumvalue
maximumvalue
Returns
function returns true if value is greater than or equal to aMin and less than or Equal to aMax. It returns false if value is less than aMin or greater than aMax

◆ isZero()

template<typename T >
bool MathFuncs::isZero ( T  input,
T  epsilon = (T) std::numeric_limits<T>::epsilon() 
)
static

Function checks if value is zero.

Parameters
inputvalue
limit
Returns
function returns true is value is zero

◆ lcm()

template<typename T >
T MathFuncs::lcm ( T  first,
T  second 
)
static

Function returns lowest common multiple for for two values.

Parameters
firstvalue
secondvalue
Returns
function returns lowest common multiple

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