8#ifndef _LIMBO_MATH_MATH
9#define _LIMBO_MATH_MATH
21inline T
abs(T
const& t)
23 return (t > 0)? t : -t;
30template <
typename Iterator>
31inline 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)
43template <
typename Iterator>
44inline 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)
60template <
typename Iterator>
61inline 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)
76template <
typename Iterator>
77inline 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)
99 return std::numeric_limits<char>::min();
105 return std::numeric_limits<unsigned char>::min();
111 return std::numeric_limits<short>::min();
117 return std::numeric_limits<unsigned short>::min();
123 return std::numeric_limits<int>::min();
129 return std::numeric_limits<unsigned int>::min();
135 return std::numeric_limits<long>::min();
141 return std::numeric_limits<unsigned long>::min();
147 return std::numeric_limits<long long>::min();
153 return std::numeric_limits<unsigned long long>::min();
159 return -std::numeric_limits<float>::max();
165 return -std::numeric_limits<double>::max();
171 return -std::numeric_limits<long double>::max();
long long lowest< long long >()
specialization for integer types
std::iterator_traits< Iterator >::value_type max(Iterator first, Iterator last)
get max of an array
unsigned long long lowest< unsigned long long >()
specialization for integer types
unsigned int lowest< unsigned int >()
specialization for integer types
std::iterator_traits< Iterator >::value_type min(Iterator first, Iterator last)
get min of an array
std::iterator_traits< Iterator >::value_type sum(Iterator first, Iterator last)
get summation of an array
std::iterator_traits< Iterator >::value_type average(Iterator first, Iterator last)
get average of an array
char lowest< char >()
specialization for integer types
long double lowest< long double >()
specialization for floating point types
unsigned char lowest< unsigned char >()
specialization for integer types
short lowest< short >()
specialization for integer types
int lowest< int >()
specialization for integer types
double lowest< double >()
specialization for floating point types
float lowest< float >()
specialization for floating point types
T abs(T const &t)
generalized api can handle both integer and floating points
T lowest()
generic function to get lowest value of numbers
unsigned short lowest< unsigned short >()
specialization for integer types
unsigned long lowest< unsigned long >()
specialization for integer types
long lowest< long >()
specialization for integer types