8 #ifndef INCLUDED_UHD_UTILS_MATH_HPP 9 #define INCLUDED_UHD_UTILS_MATH_HPP 14 #include <boost/numeric/conversion/bounds.hpp> 40 static const float SINGLE_PRECISION_EPSILON = 1.19e-7f;
41 static const double DOUBLE_PRECISION_EPSILON = 2.22e-16;
43 namespace fp_compare {
105 bool operator<(fp_compare_epsilon<float_t> lhs,
double rhs);
107 bool operator<=(fp_compare_epsilon<float_t> lhs,
double rhs);
118 bool operator<(double lhs, fp_compare_epsilon<float_t> rhs);
120 bool operator<=(double lhs, fp_compare_epsilon<float_t> rhs);
135 static const float SINGLE_PRECISION_DELTA = 1e-3f;
136 static const double DOUBLE_PRECISION_DELTA = 1e-5;
139 static const double FREQ_COMPARISON_DELTA_HZ = 0.1;
142 namespace fp_compare {
160 UHD_INLINE fp_compare_delta(float_t value, float_t delta);
189 bool operator<(fp_compare_delta<float_t> lhs,
double rhs);
191 bool operator<=(fp_compare_delta<float_t> lhs,
double rhs);
202 bool operator<(double lhs, fp_compare_delta<float_t> rhs);
204 bool operator<=(double lhs, fp_compare_delta<float_t> rhs);
223 return std::log(x) / std::log(float_t(2));
UHD_INLINE bool frequencies_are_equal(double lhs, double rhs)
Definition: math.hpp:212
float_t _value
Definition: math.hpp:165
UHD_INLINE float_t log2(float_t x)
Portable log2()
Definition: math.hpp:219
UHD_INLINE bool operator>=(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:87
UHD_INLINE bool operator>(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:81
UHD_INLINE bool operator!=(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:65
float_t _delta
Definition: math.hpp:166
float_t _epsilon
Definition: math.hpp:67
Definition: build_info.hpp:14
#define UHD_INLINE
Definition: config.h:53
UHD_INLINE ~fp_compare_epsilon()
Definition: fp_compare_epsilon.ipp:44
float_t _value
Definition: math.hpp:66
UHD_INLINE void operator=(const fp_compare_epsilon ©)
Definition: fp_compare_epsilon.ipp:48
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:59