math.beta/include/math/MathDefs.h

36 lines
747 B
C++

/* __ __ ___ _____ ____
* \ \ / / / _ \ | __ \ | |
* \ \/\/ / / / \ \ | | / / | __|
* \_/\_/ /_/ \_\ |_| \_\ |_|
* Take it to the next Level
*
* 2009 Brian Ernst.
* See ReadMe.md for more license info.
*/
#ifndef __MATHDEFS_H__
#define __MATHDEFS_H__
# include <limits>
# include <math.h>
typedef float Scalar;
template< typename T >
inline int cmpf( T lhs, T rhs )
{
return abs( lhs - rhs ) < std::numeric_limits< T >::epsilon( ) ? 0 : (lhs < rhs ? -1 : 1 );
}
template< typename T >
inline T min( T lhs, T rhs )
{
return lhs < rhs ? lhs : rhs;
}
template< typename T >
inline T max( T lhs, T rhs )
{
return lhs > rhs ? lhs : rhs;
}
#endif