18 #ifndef INCLUDED_UHD_UTILS_MATH_HPP 19 #define INCLUDED_UHD_UTILS_MATH_HPP 22 #include <boost/cstdint.hpp> 23 #include <boost/numeric/conversion/bounds.hpp> 44 static const boost::int32_t BOOST_INT32_MAX = boost::numeric::bounds<boost::int32_t>::highest();
45 static const boost::int32_t BOOST_INT32_MIN = boost::numeric::bounds<boost::int32_t>::lowest();
63 static const float SINGLE_PRECISION_EPSILON = 1.19e-7;
64 static const double DOUBLE_PRECISION_EPSILON = 2.22e-16;
66 namespace fp_compare {
128 bool operator<(fp_compare_epsilon<float_t> lhs,
double rhs);
130 bool operator<=(fp_compare_epsilon<float_t> lhs,
double rhs);
141 bool operator<(double lhs, fp_compare_epsilon<float_t> rhs);
143 bool operator<=(double lhs, fp_compare_epsilon<float_t> rhs);
158 static const float SINGLE_PRECISION_DELTA = 1e-3;
159 static const double DOUBLE_PRECISION_DELTA = 1e-5;
162 static const double FREQ_COMPARISON_DELTA_HZ = 0.1;
165 namespace fp_compare {
183 UHD_INLINE fp_compare_delta(float_t value, float_t delta);
212 bool operator<(fp_compare_delta<float_t> lhs,
double rhs);
214 bool operator<=(fp_compare_delta<float_t> lhs,
double rhs);
225 bool operator<(double lhs, fp_compare_delta<float_t> rhs);
227 bool operator<=(double lhs, fp_compare_delta<float_t> rhs);
UHD_INLINE bool frequencies_are_equal(double lhs, double rhs)
Definition: math.hpp:235
float_t _value
Definition: math.hpp:188
UHD_INLINE bool operator>=(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:97
UHD_INLINE bool operator>(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:91
UHD_INLINE bool operator!=(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:75
float_t _delta
Definition: math.hpp:189
float_t _epsilon
Definition: math.hpp:90
Definition: convert.hpp:28
#define UHD_INLINE
Definition: config.hpp:69
UHD_INLINE ~fp_compare_epsilon()
Definition: fp_compare_epsilon.ipp:54
float_t _value
Definition: math.hpp:89
UHD_INLINE void operator=(const fp_compare_epsilon ©)
Definition: fp_compare_epsilon.ipp:58
UHD_INLINE fp_compare_epsilon(float_t value)
UHD_INLINE bool operator==(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:69