| 379 | // Returns `true` if `out` overflows when converted from `as_double`. |
| 380 | template <class T> |
| 381 | static inline bool CheckForOverflow(double as_double, T* out) { |
| 382 | return (sizeof(T) < sizeof(double) && std::isinf(*out) && |
| 383 | std::isfinite(as_double)); |
| 384 | } |
| 385 | |
| 386 | // There is no `std::isinf` that takes `Eigen::half` as argument but Eigen |
| 387 | // provides `Eigen::half_impl::isinf` instead. |