18 #ifndef INCLUDED_UHD_UTILS_MATH_HPP 19 #define INCLUDED_UHD_UTILS_MATH_HPP 23 #include <boost/cstdint.hpp> 24 #include <boost/numeric/conversion/bounds.hpp> 50 static const float SINGLE_PRECISION_EPSILON = 1.19e-7f;
51 static const double DOUBLE_PRECISION_EPSILON = 2.22e-16;
53 namespace fp_compare {
115 bool operator<(fp_compare_epsilon<float_t> lhs,
double rhs);
117 bool operator<=(fp_compare_epsilon<float_t> lhs,
double rhs);
128 bool operator<(double lhs, fp_compare_epsilon<float_t> rhs);
130 bool operator<=(double lhs, fp_compare_epsilon<float_t> rhs);
145 static const float SINGLE_PRECISION_DELTA = 1e-3f;
146 static const double DOUBLE_PRECISION_DELTA = 1e-5;
149 static const double FREQ_COMPARISON_DELTA_HZ = 0.1;
152 namespace fp_compare {
170 UHD_INLINE fp_compare_delta(float_t value, float_t delta);
199 bool operator<(fp_compare_delta<float_t> lhs,
double rhs);
201 bool operator<=(fp_compare_delta<float_t> lhs,
double rhs);
212 bool operator<(double lhs, fp_compare_delta<float_t> rhs);
214 bool operator<=(double lhs, fp_compare_delta<float_t> rhs);
233 return std::log(x) / std::log(float_t(2));
UHD_INLINE bool frequencies_are_equal(double lhs, double rhs)
Definition: math.hpp:222
float_t _value
Definition: math.hpp:175
UHD_INLINE float_t log2(float_t x)
Portable log2()
Definition: math.hpp:229
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:176
float_t _epsilon
Definition: math.hpp:77
Definition: build_info.hpp:25
#define UHD_INLINE
Definition: config.h:63
UHD_INLINE ~fp_compare_epsilon()
Definition: fp_compare_epsilon.ipp:54
float_t _value
Definition: math.hpp:76
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