35 #ifndef _BLAZE_MATH_FUNCTIONS_H_
36 #define _BLAZE_MATH_FUNCTIONS_H_
65 template<
typename T >
66 inline int sign( T a );
68 template<
typename T >
69 inline size_t digits( T a );
71 template<
typename T1,
typename T2 >
72 inline const typename MathTrait<T1,T2>::HighType
73 min(
const T1& a,
const T2& b );
75 template<
typename T1,
typename T2,
typename T3 >
76 inline const typename MathTrait< typename MathTrait<T1,T2>::HighType, T3 >::HighType
77 min(
const T1& a,
const T2& b,
const T3& c );
79 template<
typename T1,
typename T2 >
80 inline const typename MathTrait<T1,T2>::HighType
81 max(
const T1& a,
const T2& b );
83 template<
typename T1,
typename T2,
typename T3 >
84 inline const typename MathTrait< typename MathTrait<T1,T2>::HighType, T3 >::HighType
85 max(
const T1& a,
const T2& b,
const T3& c );
87 template<
typename T >
88 inline T
round( T a );
90 template<
typename T1,
typename T2 >
106 template<
typename T >
112 return ( T(0) < a ) - ( a < T(0) );
137 template<
typename T >
166 template<
typename T1,
typename T2 >
176 return ( a < b )?( a ):( b );
194 template<
typename T1,
typename T2,
typename T3 >
195 inline const typename MathTrait< typename MathTrait<T1,T2>::HighType, T3 >::HighType
196 min(
const T1& a,
const T2& b,
const T3& c )
205 return ( a < b )?( ( a < c )?( a ):( c ) ):( ( b < c )?( b ):( c ) );
222 template<
typename T1,
typename T2 >
232 return ( a < b )?( b ):( a );
250 template<
typename T1,
typename T2,
typename T3 >
251 inline const typename MathTrait< typename MathTrait<T1,T2>::HighType, T3 >::HighType
252 max(
const T1& a,
const T2& b,
const T3& c )
261 return ( a < b )?( ( b < c )?( c ):( b ) ):( ( a < c )?( c ):( a ) );
278 template<
typename T >
300 inline float round(
float a )
302 return std::floor( a + 0.5F );
321 inline double round<double>(
double a )
323 return std::floor( a + 0.5 );
342 inline long double round<long double>(
long double a )
344 return std::floor( a + 0.5L );
361 template<
typename T >
362 inline bool lessThan_backend( T a, T b )
385 inline bool lessThan_backend<float>(
float a,
float b )
387 return ( b - a ) > 1E-8F;
408 inline bool lessThan_backend<double>(
double a,
double b )
410 return ( b - a ) > 1E-8;
431 inline bool lessThan_backend<long double>(
long double a,
long double b )
433 return ( b - a ) > 1E-10;
451 template<
typename T1,
typename T2 >
455 return lessThan_backend<High>( a, b );
Base template for the MathTrait class.
Definition: MathTrait.h:127
Compile time check for signed data types.This type trait tests whether or not the given template para...
Definition: IsSigned.h:96
int sign(T a)
Sign function.
Definition: Functions.h:107
#define BLAZE_CONSTRAINT_MUST_BE_INTEGRAL_TYPE(T)
Constraint on the data type.In case the given data type T is not an integral data type...
Definition: Integral.h:78
Header file for the IsFloatingPoint type trait.
T round(T a)
Rounds the given input value.
Definition: Functions.h:279
Compile time check for floating point data types.This type trait tests whether or not the given templ...
Definition: IsFloatingPoint.h:94
Constraint on the data type.
Constraint on the data type.
bool lessThan(T1 a, T2 b)
Generic less-than comparison.
Definition: Functions.h:452
Header file for the IsSigned type trait.
Header file for the mathematical trait.
#define BLAZE_CONSTRAINT_MUST_BE_BUILTIN_TYPE(T)
Constraint on the data type.In case the given data type T is not a built-in data type, a compilation error is created.
Definition: Builtin.h:78
Header file for basic type definitions.
size_t digits(T a)
Returns the number of valid digits of an integral value.
Definition: Functions.h:138
Constraint on the data type.