On 3/13/23 09:06, Jakub Jelinek wrote:
On Mon, Mar 13, 2023 at 08:59:15AM +0100, Aldy Hernandez wrote:
Yes, sure - I just noticed that we're forced to use high-level API for
something that's quite low-level and should be internal (a range
"breaking" internal consistency checks).
Yeah, let's fix the API. No sense hacking around things if what we need is
to tweak the design.
I don't like hacking around things. It always comes back to bite me ;-).
Sure. The current state is that I think the actual bugs are fixed except
for the !MODE_HAS_INFINITIES case which people rarely use, so fixing up the
API can wait even to next release.
For !MODE_HAS_INFINITIES, I wonder if the best fix wouldn't be to change
set and a few other spots, so that if the boundaries are
real_min_representable/real_max_representable, we widen them to -inf and inf
and change frange_val_min/max to also be dconstninf/dconstinf for
!MODE_HAS_INFINITIES, because the min/max for that case (probably) really work
as
infinities. Whenever we actually round that value to mode, it will become
real_min_representable/real_max_representable again.
But that can also wait a week.
That sounds very reasonable. It would remove special casing and would
make the code easier to read. For that matter, that was what I had in
the original implementation.
Aldy