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