NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/59811: strpct round-off error
The changes for this are committed now, and will (in a few days probably)
get requested for pullup to -11 (not to anything earlier than that).
I decided to go with a hybrid (union) of both earlier suggested methods.
As I indicated in the previous message (last Tues) I believe that the
strpct_r (etc) version is the way forward.
Then I looked at the strpct tests ... I just couldn't face updating all
of that with changed default rounding, or not this week anyway, so if
things had been left as stated, that test would have failed.
The only way to avoid that, which I have done - and which is also probably
the right thing for backward compat, is to keep the older strpct() and
strspct() doing "round toward zero" as they have always done, rather than
changing them to be "round to nearest" which is a more rational default.
So, that's what I did.
But rather than condemn those functions to always be that, meaning that
the (very few) uses of them would probably change to use the new versions,
for better rounding, I added the strpct_round() function, to allow the
default rounding mode to be altered - and then added a call to that in df(1)
to set its rounding mode to "round away from zero" as POSIX requires (which
seems to be working just fine - one of my filesystems reports 41% full with
the modified df, just 40% full with the old one).
We can perhaps revisit changing the default rounding mode for strpct and
strspct sometime later.
Otherwise, unless someone can break the updated code, I think this is done
(after the pullup happens).
kre
Home |
Main Index |
Thread Index |
Old Index