diff options
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/utils/fp_compare_delta.ipp | 20 | ||||
-rw-r--r-- | host/include/uhd/utils/math.hpp | 2 |
2 files changed, 11 insertions, 11 deletions
diff --git a/host/include/uhd/utils/fp_compare_delta.ipp b/host/include/uhd/utils/fp_compare_delta.ipp index 092ade6e9..49cbc281b 100644 --- a/host/include/uhd/utils/fp_compare_delta.ipp +++ b/host/include/uhd/utils/fp_compare_delta.ipp @@ -100,8 +100,8 @@ namespace uhd { namespace math { namespace fp_compare { template<typename float_t> UHD_INLINE bool operator==(fp_compare_delta<float_t> lhs, double rhs) { - float_t delta = fp_compare_select_delta(double(lhs._delta), - DOUBLE_PRECISION_DELTA); + float_t delta = float_t(fp_compare_select_delta(double(lhs._delta), + DOUBLE_PRECISION_DELTA)); return (std::fabs(lhs._value - rhs) < delta); } @@ -112,8 +112,8 @@ namespace uhd { namespace math { namespace fp_compare { template<typename float_t> UHD_INLINE bool operator<(fp_compare_delta<float_t> lhs, double rhs) { - float_t delta = fp_compare_select_delta(double(lhs._delta), - DOUBLE_PRECISION_DELTA); + float_t delta = float_t(fp_compare_select_delta(double(lhs._delta), + DOUBLE_PRECISION_DELTA)); return ((rhs - lhs._value) > delta); } @@ -124,8 +124,8 @@ namespace uhd { namespace math { namespace fp_compare { template<typename float_t> UHD_INLINE bool operator>(fp_compare_delta<float_t> lhs, double rhs) { - float_t delta = fp_compare_select_delta(double(lhs._delta), - DOUBLE_PRECISION_DELTA); + float_t delta = float_t(fp_compare_select_delta(double(lhs._delta), + DOUBLE_PRECISION_DELTA)); return ((lhs._value - rhs) > delta); } @@ -148,8 +148,8 @@ namespace uhd { namespace math { namespace fp_compare { template<typename float_t> UHD_INLINE bool operator<(double lhs, fp_compare_delta<float_t> rhs) { - float_t delta = fp_compare_select_delta(DOUBLE_PRECISION_DELTA, - double(rhs._delta)); + float_t delta = float_t(fp_compare_select_delta(DOUBLE_PRECISION_DELTA, + double(rhs._delta))); return ((rhs._value - lhs) > delta); } @@ -160,8 +160,8 @@ namespace uhd { namespace math { namespace fp_compare { template<typename float_t> UHD_INLINE bool operator>(double lhs, fp_compare_delta<float_t> rhs) { - float_t delta = fp_compare_select_delta(DOUBLE_PRECISION_DELTA, - double(rhs._delta)); + float_t delta = float_t(fp_compare_select_delta(DOUBLE_PRECISION_DELTA, + double(rhs._delta))); return ((lhs - rhs._value) > delta); } diff --git a/host/include/uhd/utils/math.hpp b/host/include/uhd/utils/math.hpp index e6ac4d3dc..4f88494d6 100644 --- a/host/include/uhd/utils/math.hpp +++ b/host/include/uhd/utils/math.hpp @@ -155,7 +155,7 @@ namespace fp_compare { * These are the default deltas used by the 'fp_compare_delta' class for * single and double-precision floating point comparisons. */ - static const float SINGLE_PRECISION_DELTA = 1e-3; + static const float SINGLE_PRECISION_DELTA = 1e-3f; static const double DOUBLE_PRECISION_DELTA = 1e-5; /*! Floating-point delta to use for frequency comparisons. */ |