7 #ifndef INCLUDED_UHD_UTILS_MATH_HPP 8 #define INCLUDED_UHD_UTILS_MATH_HPP 13 #include <boost/numeric/conversion/bounds.hpp> 39 static const float SINGLE_PRECISION_EPSILON = 1.19e-7f;
40 static const double DOUBLE_PRECISION_EPSILON = 2.22e-16;
42 namespace fp_compare {
104 bool operator<(fp_compare_epsilon<float_t> lhs,
double rhs);
106 bool operator<=(fp_compare_epsilon<float_t> lhs,
double rhs);
117 bool operator<(double lhs, fp_compare_epsilon<float_t> rhs);
119 bool operator<=(double lhs, fp_compare_epsilon<float_t> rhs);
134 static const float SINGLE_PRECISION_DELTA = 1e-3f;
135 static const double DOUBLE_PRECISION_DELTA = 1e-5;
138 static const double FREQ_COMPARISON_DELTA_HZ = 0.1;
141 namespace fp_compare {
159 UHD_INLINE fp_compare_delta(float_t value, float_t delta);
188 bool operator<(fp_compare_delta<float_t> lhs,
double rhs);
190 bool operator<=(fp_compare_delta<float_t> lhs,
double rhs);
201 bool operator<(double lhs, fp_compare_delta<float_t> rhs);
203 bool operator<=(double lhs, fp_compare_delta<float_t> rhs);
222 return std::log(x) / std::log(float_t(2));
UHD_INLINE bool frequencies_are_equal(double lhs, double rhs)
Definition: math.hpp:211
float_t _value
Definition: math.hpp:164
UHD_INLINE float_t log2(float_t x)
Portable log2()
Definition: math.hpp:218
UHD_INLINE bool operator>=(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:86
UHD_INLINE bool operator>(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:80
UHD_INLINE bool operator!=(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:64
float_t _delta
Definition: math.hpp:165
float_t _epsilon
Definition: math.hpp:66
Definition: build_info.hpp:14
#define UHD_INLINE
Definition: config.h:52
UHD_INLINE ~fp_compare_epsilon()
Definition: fp_compare_epsilon.ipp:43
float_t _value
Definition: math.hpp:65
UHD_INLINE void operator=(const fp_compare_epsilon ©)
Definition: fp_compare_epsilon.ipp:47
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:58