
On Tuesday, January 21st, 2025 at 2:15 PM, Peter Dimov via Boost
Assuming normalized numbers (which should be the case) of the same sign,
operator< is equivalent (NaN notwithstanding) to comparing the two integers
eeeeeeee... mmmmmmmmmm...
I'm not quite sure whether zero needs to be a special case here. There's special case logic in operator< for it, but I'm not positive it's needed.
The current operator< is this:
This is a sketch of what I was thinking about:
I haven't run this against the test suite, so it might not be quite correct, but it looks correct to me. :-)
It assumes that zeroes are normalized. The current implementation seems to not assume that; it handles 0e+7, but since the _fast types are supposed to be normalized, this should never happen, should it?
For fast types everything is normalized. Originally I was just skipping the decoding step by storing in the struct, but then after profiling adding normalization to the constructor provided significant gains. I guess I never removed all the old assumptions.
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:
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost