#include #include #include #include namespace DB { namespace { struct IsFiniteImpl { /// Better implementation, because isinf, isfinite, isnan are not inlined for unknown reason. /// Assuming IEEE 754. /// NOTE gcc 7 doesn't vectorize this loop. static constexpr auto name = "isFinite"; template static bool execute(const T t) { if constexpr (std::is_same_v) return (bit_cast(t) & 0b01111111100000000000000000000000) != 0b01111111100000000000000000000000; else if constexpr (std::is_same_v) return (bit_cast(t) & 0b0111111111110000000000000000000000000000000000000000000000000000) != 0b0111111111110000000000000000000000000000000000000000000000000000; else { (void)t; return true; } } }; using FunctionIsFinite = FunctionNumericPredicate; } REGISTER_FUNCTION(IsFinite) { factory.registerFunction(); } }