#pragma once #include #include #include /// To be sure, that this function is zero-cost for non-floating point types. template inline typename std::enable_if::value, bool>::type isNaN(T x) { return std::isnan(x); } template inline typename std::enable_if::value, bool>::type isNaN(T x) { return false; } template inline typename std::enable_if::value, bool>::type isFinite(T x) { return std::isfinite(x); } template inline typename std::enable_if::value, bool>::type isFinite(T x) { return true; } template typename std::enable_if::value, T>::type NaNOrZero() { return std::numeric_limits::quiet_NaN(); } template typename std::enable_if::is_integer, T>::type NaNOrZero() { return 0; } template typename std::enable_if::value, T>::type NaNOrZero() { return T{}; }