aboutsummaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/utils/math.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/host/include/uhd/utils/math.hpp b/host/include/uhd/utils/math.hpp
index aca0b7c92..d442d6a94 100644
--- a/host/include/uhd/utils/math.hpp
+++ b/host/include/uhd/utils/math.hpp
@@ -234,6 +234,17 @@ UHD_INLINE bool frequencies_are_equal(double lhs, double rhs)
== fp_compare::fp_compare_delta<double>(rhs, FREQ_COMPARISON_DELTA_HZ));
}
+inline double dB_to_lin(const double dB_val)
+{
+ return std::pow(10, (dB_val) / 10.0);
+}
+
+inline double lin_to_dB(const double val)
+{
+ return 10 * std::log10(val);
+}
+
+
//! Portable version of lcm() across Boost versions
template <typename IntegerType>
inline IntegerType lcm(IntegerType x, IntegerType y)