8 #ifndef _LIMBO_MATH_MATH
9 #define _LIMBO_MATH_MATH
21 inline T
abs(T
const& t)
23 return (t > 0)? t : -t;
30 template <
typename Iterator>
31 inline typename std::iterator_traits<Iterator>::value_type
sum(Iterator first, Iterator last)
33 typename std::iterator_traits<Iterator>::value_type v = 0;
34 for (; first != last; ++first)
43 template <
typename Iterator>
44 inline typename std::iterator_traits<Iterator>::value_type
average(Iterator first, Iterator last)
46 typename std::iterator_traits<Iterator>::value_type v = 0;
48 for (; first != last; ++first)
60 template <
typename Iterator>
61 inline typename std::iterator_traits<Iterator>::value_type
max(Iterator first, Iterator last)
63 typename std::iterator_traits<Iterator>::value_type v = *first;
64 for (; first != last; ++first)
76 template <
typename Iterator>
77 inline typename std::iterator_traits<Iterator>::value_type
min(Iterator first, Iterator last)
79 typename std::iterator_traits<Iterator>::value_type v = *first;
80 for (; first != last; ++first)
int lowest< int >()
specialization for integer types
long long lowest< long long >()
specialization for integer types
unsigned int lowest< unsigned int >()
specialization for integer types
T abs(T const &t)
generalized api can handle both integer and floating points
char lowest< char >()
specialization for integer types
std::iterator_traits< Iterator >::value_type average(Iterator first, Iterator last)
get average of an array
unsigned long lowest< unsigned long >()
specialization for integer types
std::iterator_traits< Iterator >::value_type sum(Iterator first, Iterator last)
get summation of an array
long double lowest< long double >()
specialization for floating point types
std::iterator_traits< Iterator >::value_type max(Iterator first, Iterator last)
get max of an array
unsigned short lowest< unsigned short >()
specialization for integer types
short lowest< short >()
specialization for integer types
double lowest< double >()
specialization for floating point types
float lowest< float >()
specialization for floating point types
unsigned char lowest< unsigned char >()
specialization for integer types
long lowest< long >()
specialization for integer types
std::iterator_traits< Iterator >::value_type min(Iterator first, Iterator last)
get min of an array
unsigned long long lowest< unsigned long long >()
specialization for integer types