| 402 | /// \retval true if infinity |
| 403 | /// \retval false else |
| 404 | template<typename T> bool builtin_isinf(T arg) |
| 405 | { |
| 406 | #if HALF_ENABLE_CPP11_CMATH |
| 407 | return std::isinf(arg); |
| 408 | #elif defined(_MSC_VER) |
| 409 | return !::_finite(static_cast<double>(arg)) && !::_isnan(static_cast<double>(arg)); |
| 410 | #else |
| 411 | return arg == std::numeric_limits<T>::infinity() || arg == -std::numeric_limits<T>::infinity(); |
| 412 | #endif |
| 413 | } |
| 414 | |
| 415 | /// Check for NaN. |
| 416 | /// \tparam T argument type (builtin floating point type) |