Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2025-01-21 19:51:57


> > 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:
>
> https://godbolt.org/z/bqWKxbdjd

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.


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