Boost logo

Boost :

From: Gero Peterhoff (g.peterhoff_at_[hidden])
Date: 2023-04-20 20:44:04


Hi Matt,
I see the following problems in your implementations for ccmath::copysign/signbit:
1) copysign uses abs, which is wrong. copysign/signbit may *only* change/check the sign (https://en.cppreference.com/w/cpp/numeric/math/copysign https://en.cppreference.com/w/cpp/numeric/math/signbit)!
2) In signbit.hpp you implement struct IEEEfN2bits. But these are incomplete:
- long double can be 16/12/10 bytes depending on platform/compiler option. You do not take this into account.
- Correct types are already available in boost/math/cstdfloat/cstdfloat_types.hpp.

Therefore, I provide the complete structures in ccmath/bits.hpp. This also contains structures for std::(b)float16_t and can be extended if needed.


Extended type-traits for floats
To minimize completely sprawling manual checks (#if + std::is_same) I provide more advanced TTs in type_traits/is_floating_point_more.hpp.


This way ccmath::copysign/signbit can be implemented correctly. Possibly other functions are affected.


thx
Gero


PS
gcc13 is about to be released (https://gcc.gnu.org), so it is high time to support std::floatN_t as well.








Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk