This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Make printf respect the rounding mode for decimal output (bug 5044)
- From: Roland McGrath <roland at hack dot frob dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Fri, 14 Sep 2012 10:21:29 -0700 (PDT)
- Subject: Re: Make printf respect the rounding mode for decimal output (bug 5044)
- References: <Pine.LNX.4.64.1209140115260.32393@digraph.polyomino.org.uk>
> @@ -955,34 +954,31 @@ ___printf_fp (FILE *fp,
> }
>
> /* Do rounding. */
> - digit = hack_digit ();
> - if (digit > L'4')
> + wchar_t last_digit = *(wcp - 1) != decimalwc ? *(wcp - 1) : *(wcp - 2);
Usual style is "wcp[-1]".
I don't see any substantive issues with the code, but I don't really
understand it.
Thanks,
Roland