diff --git a/base/base/BFloat16.h b/base/base/BFloat16.h index 2df84dbc0f2..00848038fe9 100644 --- a/base/base/BFloat16.h +++ b/base/base/BFloat16.h @@ -311,11 +311,3 @@ constexpr inline auto operator/(BFloat16 a, T b) { return Float32(a) / b; } - - -namespace std -{ - inline constexpr bool isfinite(BFloat16 x) { return x.isFinite(); } - inline constexpr bool isnan(BFloat16 x) { return x.isNaN(); } - inline constexpr bool signbit(BFloat16 x) { return x.signBit(); } -} diff --git a/src/Columns/ColumnVector.cpp b/src/Columns/ColumnVector.cpp index 0308b7028fb..84fc6ebc61d 100644 --- a/src/Columns/ColumnVector.cpp +++ b/src/Columns/ColumnVector.cpp @@ -120,7 +120,7 @@ struct ColumnVector::less_stable if constexpr (is_floating_point) { - if (unlikely(std::isnan(parent.data[lhs]) && std::isnan(parent.data[rhs]))) + if (unlikely(isNaN(parent.data[lhs]) && isNaN(parent.data[rhs]))) { return lhs < rhs; } @@ -152,7 +152,7 @@ struct ColumnVector::greater_stable if constexpr (is_floating_point) { - if (unlikely(std::isnan(parent.data[lhs]) && std::isnan(parent.data[rhs]))) + if (unlikely(isNaN(parent.data[lhs]) && isNaN(parent.data[rhs]))) { return lhs < rhs; } diff --git a/src/Common/NaNUtils.h b/src/Common/NaNUtils.h index 3e4af902104..3b99084549f 100644 --- a/src/Common/NaNUtils.h +++ b/src/Common/NaNUtils.h @@ -46,3 +46,12 @@ T NaNOrZero() else return {}; } + +template +bool signBit(T x) +{ + if constexpr (is_floating_point) + return DecomposedFloat(x).isNegative(); + else + return x < 0; +} diff --git a/src/IO/WriteHelpers.h b/src/IO/WriteHelpers.h index 0a32c4c5446..f7b2504f664 100644 --- a/src/IO/WriteHelpers.h +++ b/src/IO/WriteHelpers.h @@ -551,7 +551,7 @@ void writeJSONNumber(T x, WriteBuffer & ostr, const FormatSettings & settings) { if constexpr (is_floating_point) { - if (std::signbit(x)) + if (signBit(x)) { if (isNaN(x)) writeCString("-nan", ostr); diff --git a/src/Interpreters/AggregatedData.h b/src/Interpreters/AggregatedData.h index 4b581c682ca..1a804afd33e 100644 --- a/src/Interpreters/AggregatedData.h +++ b/src/Interpreters/AggregatedData.h @@ -1,12 +1,16 @@ #pragma once + #include #include #include #include #include + + namespace DB { + /** Different data structures that can be used for aggregation * For efficiency, the aggregation data itself is put into the pool. * Data and pool ownership (states of aggregate functions)