Boost logo

Boost :

From: pbristow_at_[hidden]
Date: 2020-09-07 09:24:32

> -----Original Message-----
> From: Boost <boost-bounces_at_[hidden]> On Behalf Of Gero Peterhoff via Boost
> Sent: 6 September 2020 23:01
> To: boost_at_[hidden]
> Cc: Gero Peterhoff <g.peterhoff_at_[hidden]>
> Subject: [boost] type detection macros + multiprecision + io
> Hello Developer,
> I noticed that some type detection macros and boost::float128_type or numeric_limits do not work
> reliably:
> - BOOST_HAS_FLOAT128 with clang and icc do not work, gcc is ok
> - BOOST_HAS_CHAR32/16_T, BOOST_NO_CHAR32/16_T are not defined, but either BOOST_HAS_TYPE
> or BOOST_NO_TYPE should be defined; see later
> - with clang there is no boost::float128_type and an error when including
> boost/multiprecision/float128.hpp (quadmath.h)
> - with clang and icc the numeric_limits<float128_t> are not available (gcc ok) see
> In general it would make sense:
> - convert the detection macros to a uniform naming scheme:
> always BOOST_HAS_TYPE_T (with _T at the end) or BOOST_HAS_TYPE (without _T), but not
> mixed/both
> - in multiprecision and math:
> 1) float: renaming typenames to eg floatBits_mbt (m: multiprecision, b: binary); floatBits_mdt (d:
> decimal)
> 2) integer: renaming typenames to e.g. u/intBits_mt; u/intBits_mct (c: checked)
> 3) based on this, renaming boost::float/int128_type to boost::float/int128_t
> so that it is always clear and there is no confusion.
> You can do that for all types, e.g. some DSP/microcontrollers do not support u/int8/64_t etc. I did that
> quickly for gcc (has_type.hpp) - of course that has to be in the corresponding boost/config/compiler/*
> and platform/* headers are implemented.
> Building on this, feature test macros can then be made available (features.hpp).
> Can you please implement the io-operators and string-conversions for u/int128 (in e.g.
> boost/math/cstdint/cstdint_iostream.hpp)?

I think that BOOST_HAS_FLOAT128 Is telling the truth - it does not work for Clang and Intel ☹ (but does for GCC 😊)

On float128 support, we discussed some progress on but I have yet to get this to work on Windows Mingw and Clang 9.
It would be good to hear if others have made more progress (you report an unspecified error).

If you want to use 128-bit float, you can always use the Boost.Multiprecision cpp_bin_float_quad type, but it is slower of course than the hand-crafted assembler in quadmath.h.

It is possible to use the macro BOOST_HAS_FLOAT128 To use float128 when available else cpp_bin_float_quad so you can make it 'compiler portable' for now.

IO Operators and string convertors would indeed be nice. Code most welcome 😉

I am sure the @jzmaddock, custodian of Boost config will comment on the other suggestions.



Boost list run by bdawes at, gregod at, cpdaniel at, john at