// Distributed under the Boost Software License Version 1.0 https://www.boost.org/LICENSE_1_0.txt // Copyright Gero Peterhoff #ifndef BOOST_TYPE_TRAITS_IS_FLOATING_POINT_MORE_HPP #define BOOST_TYPE_TRAITS_IS_FLOATING_POINT_MORE_HPP #include #include #include #include // todo float8 // https://www.heise.de/news/Gleitkommazahlen-im-Machine-Learning-Weniger-ist-mehr-fuer-Intel-Nvidia-und-ARM-7264714.html namespace boost { // std-types template struct is_std_longdouble : public integral_constant < bool, is_same::type>::value > {}; template struct is_std_double : public integral_constant < bool, is_same::type>::value > {}; template struct is_std_float : public integral_constant < bool, is_same::type>::value > {}; // add C++23-types #if defined(__STDCPP_FLOAT128_T__) template <> struct is_floating_point : public true_type{}; #endif #if defined(__STDCPP_FLOAT64_T__) template <> struct is_floating_point : public true_type{}; #endif #if defined(__STDCPP_FLOAT32_T__) template <> struct is_floating_point : public true_type{}; #endif #if defined(__STDCPP_FLOAT16_T__) template <> struct is_floating_point : public true_type{}; #endif #if defined(__STDCPP_BFLOAT16_T__) template <> struct is_floating_point : public true_type{}; #endif // C++23 std-types template struct is_std_float128 : public integral_constant < bool, #if defined(__STDCPP_FLOAT128_T__) is_same::type>::value #else false #endif > {}; template struct is_std_float64 : public integral_constant < bool, #if defined(__STDCPP_FLOAT64_T__) is_same::type>::value #else false #endif > {}; template struct is_std_float32 : public integral_constant < bool, #if defined(__STDCPP_FLOAT32_T__) is_same::type>::value #else false #endif > {}; template struct is_std_float16 : public integral_constant < bool, #if defined(__STDCPP_FLOAT16_T__) is_same::type>::value #else false #endif > {}; template struct is_std_bfloat16 : public integral_constant < bool, #if defined(__STDCPP_BFLOAT16_T__) is_same::type>::value #else false #endif > {}; // boost-types template struct is_boost_float128 : public integral_constant < bool, #if defined(BOOST_CSTDFLOAT_FLOAT128_NATIVE_TYPE) is_same::type>::value #else false #endif > {}; template struct is_boost_float80 : public integral_constant < bool, #if defined(BOOST_CSTDFLOAT_FLOAT80_NATIVE_TYPE) is_same::type>::value #else false #endif > {}; template struct is_boost_float64 : public integral_constant < bool, #if defined(BOOST_CSTDFLOAT_FLOAT64_NATIVE_TYPE) is_same::type>::value #else false #endif > {}; template struct is_boost_float32 : public integral_constant < bool, #if defined(BOOST_CSTDFLOAT_FLOAT32_NATIVE_TYPE) is_same::type>::value #else false #endif > {}; template struct is_boost_float16 : public integral_constant < bool, #if defined(BOOST_CSTDFLOAT_FLOAT16_NATIVE_TYPE) is_same::type>::value #else false #endif > {}; // general template struct is_float128 : public integral_constant < bool, is_std_float128::value || is_boost_float128::value > {}; template struct is_float80 : public integral_constant < bool, is_boost_float80::value > {}; template struct is_float64 : public integral_constant < bool, is_std_float64::value || is_boost_float64::value > {}; template struct is_float32 : public integral_constant < bool, is_std_float32::value || is_boost_float32::value > {}; template struct is_float16 : public integral_constant < bool, is_std_float16::value || is_boost_float16::value > {}; template struct is_bfloat16 : public integral_constant < bool, is_std_bfloat16::value > {}; #if !defined(BOOST_NO_CXX17_INLINE_VARIABLES) template inline constexpr bool is_std_longdouble_v = is_std_longdouble::value; template inline constexpr bool is_std_double_v = is_std_double::value; template inline constexpr bool is_std_float_v = is_std_float::value; template inline constexpr bool is_std_float128_v = is_std_float128::value; template inline constexpr bool is_std_float64_v = is_std_float64::value; template inline constexpr bool is_std_float32_v = is_std_float32::value; template inline constexpr bool is_std_float16_v = is_std_float16::value; template inline constexpr bool is_std_bfloat16_v = is_std_bfloat16::value; template inline constexpr bool is_boost_float128_v = is_boost_float128::value; template inline constexpr bool is_boost_float80_v = is_boost_float80::value; template inline constexpr bool is_boost_float64_v = is_boost_float64::value; template inline constexpr bool is_boost_float32_v = is_boost_float32::value; template inline constexpr bool is_boost_float16_v = is_boost_float16::value; template inline constexpr bool is_float128_v = is_float128::value; template inline constexpr bool is_float80_v = is_float80::value; template inline constexpr bool is_float64_v = is_float64::value; template inline constexpr bool is_float32_v = is_float32::value; template inline constexpr bool is_float16_v = is_float16::value; template inline constexpr bool is_bfloat16_v = is_bfloat16::value; #endif } // boost #endif // BOOST_TYPE_TRAITS_IS_FLOATING_POINT_MORE_HPP