|
Message-ID: <CANv4PN=MvbcrCv28Z=+3BumvtivELh_teUp=O6Ogfu7Aob2CTQ@mail.gmail.com> Date: Mon, 7 Apr 2014 09:40:53 -0400 From: Morten Welinder <mwelinder@...il.com> To: musl@...ts.openwall.com Subject: Re: printf issues I am seeing another case of printing the wrong result. (This is with the pre-fix code, but I don't think that matters.) For 0xc.301316272b908p+49L (aka 6861116509411105.0L) with format "%.15Lg" I get musl: 6.86111650941111e+15 glibc: 6.8611165094111e+15 Musl has rounded to odd here for a midpoint case. Morten On Mon, Apr 7, 2014 at 3:29 AM, Rich Felker <dalias@...ifal.cx> wrote: > On Fri, Apr 04, 2014 at 08:01:00PM -0400, Morten Welinder wrote: >> I *think* the right fix is to add the following "if' statement into >> the rounding loop: >> >> while (*d > 999999999) { >> *d--=0; >> if (d < a) *--a = 0; >> (*d)++; >> } >> >> This also ought to make the d<a test afterwards unnecessary. But >> more tests would be better. > > After re-studying the code, I think this is the correct fix, and I've > committed the fix to git. I also fixed the bug where %g failed to trim > trailing zeros. > > Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.