From: Rich Felker Date: Wed, 11 May 2011 23:58:03 +0000 (-0400) Subject: fix the last known rounding bug in floating point printing X-Git-Tag: v0.7.10~1 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8628eff9128d66cc69dbc301341dc55130a9817e;p=oweals%2Fmusl.git fix the last known rounding bug in floating point printing the observed symptom was that the code was incorrectly rounding up 1.0625 to 1.063 despite the rounding mode being round-to-nearest with ties broken by rounding to even last place. however, the code was just not right in many respects, and i'm surprised it worked as well as it did. this time i tested the values that end up in the variables round, small, and the expression round+small, and all look good. --- diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index f19058d3..f13fbe10 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -326,9 +326,10 @@ static int fmt_fp(FILE *f, long double y, int w, int p, int fl, int t) if (x || d+1!=z) { long double round = CONCAT(0x1p,LDBL_MANT_DIG); long double small; - if (x