zz::math Namespace Reference

Namespace for math operations. More...

Classes

struct  Pow
 Template meta programming for pow(a, b) where a, b must be natural numbers Use Pow<a, b>::result = a^b, which is computed in compilation rather than runtime. More...
 
struct  Pow< B, 0 >
 

Functions

template<class T >
const T clip (const T &value, const T &low, const T &high)
 Clip values in-between low and high values. More...
 
int round (double value)
 fast round utilizing hardware acceleration features More...
 

Detailed Description

Namespace for math operations.

Function Documentation

template<class T >
template< class T > inline const T zz::math::clip ( const T &  value,
const T &  low,
const T &  high 
)
inline

Clip values in-between low and high values.

Parameters
valueThe value to be clipped
lowThe lower bound
highThe higher bound
Returns
Value if value in[low, high] or low if (value < low) or high if (value > high)
Note
Foolproof if low/high are not set correctly
int zz::math::round ( double  value)
inline

fast round utilizing hardware acceleration features

Parameters
value
Returns
Rounded int