
On Tuesday, January 21st, 2025 at 2:51 PM, Peter Dimov via Boost
This makes me wonder whether { uintNN_t exp_and_mant; bool sign; }
wouldn't be a better representation for _fast, although that would depend on how important comparisons are, performance-wise.
Should look somewhat like this:
Here's the current operator==:
It's not that bad but (1) it's wrong because it says -0 != +0 and (2) is_zero doesn't optimize well.
Here's operator== when using packed exponent+mantissa:
The number of instructions in op== doesn't decrease much, but in practice it should be much faster because of the early reject that will be taken most of the time.
Also, see how much better is_zero becomes.
This design could be worth investigation. We looked at bitfields originally, but since they require C++20 for constexpr support it wasn't worth pursuing.