Moving log limits to ITAConstants

parent b3ec5f9c
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
// STL // STL
#include <cmath> #include <cmath>
#include <climits> #include <numeric>
#include <limits>
namespace ITAConstants namespace ITAConstants
{ {
...@@ -51,6 +52,12 @@ namespace ITAConstants ...@@ -51,6 +52,12 @@ namespace ITAConstants
// Epsilon (distance quantization) // Epsilon (distance quantization)
static float EPS_F_L = 1.0e-5f; // 10 micro meter static float EPS_F_L = 1.0e-5f; // 10 micro meter
static double EPS_D_L = 1.0e-5f; // 10 micro meter static double EPS_D_L = 1.0e-5f; // 10 micro meter
// Log-scale limits
static float INFINITY_F = std::numeric_limits< float >::infinity();
static float MINUS_INFINITY_F = -std::numeric_limits< float >::infinity();
static float INFINITY_D = std::numeric_limits< double >::infinity();
static float MINUS_INFINITY_D = -std::numeric_limits< double >::infinity();
}; };
#endif // INCLUDE_WATCHER_ITA_CONSTANTS #endif // INCLUDE_WATCHER_ITA_CONSTANTS
...@@ -21,9 +21,7 @@ ...@@ -21,9 +21,7 @@
#include <ITABaseDefinitions.h> #include <ITABaseDefinitions.h>
#include <ITAMagnitudeSpectrum.h> #include <ITAMagnitudeSpectrum.h>
#include <ITAConstants.h>
#include <numeric>
#include <limits>
//! Third octave magnitude spectrum //! Third octave magnitude spectrum
/** /**
...@@ -149,7 +147,7 @@ public: ...@@ -149,7 +147,7 @@ public:
inline void SetZero() inline void SetZero()
{ {
for( size_t n = 0; n < m_vfValues.size(); n++ ) for( size_t n = 0; n < m_vfValues.size(); n++ )
m_vfValues[ n ] = -std::numeric_limits< float >::infinity(); m_vfValues[ n ] = ITAConstants::MINUS_INFINITY_F;
}; };
inline bool IsIdentity() const inline bool IsIdentity() const
...@@ -167,7 +165,7 @@ public: ...@@ -167,7 +165,7 @@ public:
{ {
for( size_t n = 0; n < m_vfValues.size(); n++ ) for( size_t n = 0; n < m_vfValues.size(); n++ )
{ {
if( m_vfValues[ n ] != -std::numeric_limits< float >::infinity() ) if( m_vfValues[ n ] != ITAConstants::MINUS_INFINITY_F )
return false; return false;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment