
21 Jan
2025
21 Jan
'25
7:51 p.m.
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==: https://godbolt.org/z/qc54e3hxT 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: https://godbolt.org/z/sE7f3fWf5 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.