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