OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
Namespaces | Functions
roundandclip.h File Reference

Conversion between scalar types. More...

#include <cstdint>
#include <cmath>
#include <limits>

Go to the source code of this file.

Namespaces

 InternalZGY
 Implementation not visible to clients.
 

Functions

template<typename T >
bool InternalZGY::IsFiniteT (T)
 
template<>
bool InternalZGY::IsFiniteT< float > (float value)
 
template<>
bool InternalZGY::IsFiniteT< double > (double value)
 
template<>
bool InternalZGY::IsFiniteT< long double > (long double value)
 
template<typename T >
bool InternalZGY::IsNanT (T)
 
template<>
bool InternalZGY::IsNanT< float > (float value)
 
template<>
bool InternalZGY::IsNanT< double > (double value)
 
template<>
bool InternalZGY::IsNanT< long double > (long double value)
 
template<typename T >
InternalZGY::RoundAndClip (double value)
 
template<typename T >
InternalZGY::RoundAndClip (double value, T nan)
 

Detailed Description

Conversion between scalar types.

The original code in the ZGY library and in Salmon went a bit overboard with optimizations. Up to and including inline assembly code. It is possible to bring this back, but not until it can be verified that those hacks are still relevant with current compilers.

Note: Use the more portable std::isnan() in <cmath> for all platforms. The bare "isnan" might not exist on all platforms, and/or it might be a macro which gets undefined if <cmath> happens to be included elsewhere. For similar reasons use std::isfinite unless it turns out to be proveably slower than the alternatives.