public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vincent+libc at vinc17 dot org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Subject: [Bug libc/5044] printf doesn't take the rounding mode into account Date: Fri, 18 Apr 2008 23:58:00 -0000 [thread overview] Message-ID: <20080418235810.26377.qmail@sourceware.org> (raw) In-Reply-To: <20070919134419.5044.vincent+libc@vinc17.org> ------- Additional Comments From vincent+libc at vinc17 dot org 2008-04-18 23:58 ------- (In reply to comment #10) > For example 0.5001 is really 0x1.000d1b71758e20p-1 In my example, the exact value doesn't matter: the rounding to two digits will be the same for any good approximation to 0.5001 (denoted ~0.5001 below). > "Otherwise, the source value is bounded by two adjacent decimal strings L < U, > both having DECIMAL_DIG significant digits; the value of the resultant decimal > string D should satisfy L <= D <= U, with the extra stipulation that the error > should have a correct sign for the current rounding direction." > > This implies that either L or U (.50 or .51) are allowed! No: if .50 is output, the error does not have a correct sign in rounding upward, since 0.50 < ~0.5001. So, only .51 is allowed here. Now, this part of the ISO C standard does not apply anyway since 2 digits are required and 2 <= DECIMAL_DIG. You need to look at the beginning of the paragraph: "For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most DECIMAL_DIG, then the result should be correctly rounded." and the correctly-rounded value is .51 here. -- http://sourceware.org/bugzilla/show_bug.cgi?id=5044 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
next prev parent reply other threads:[~2008-04-18 23:58 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-09-19 13:44 [Bug libc/5044] New: " vincent+libc at vinc17 dot org 2008-04-15 21:52 ` [Bug libc/5044] " eberlein at us dot ibm dot com 2008-04-15 22:54 ` vincent+libc at vinc17 dot org 2008-04-16 14:21 ` rsa at us dot ibm dot com 2008-04-16 14:21 ` rsa at us dot ibm dot com 2008-04-16 14:21 ` rsa at us dot ibm dot com 2008-04-17 20:28 ` eberlein at us dot ibm dot com 2008-04-17 20:34 ` eberlein at us dot ibm dot com 2008-04-17 23:21 ` vincent+libc at vinc17 dot org 2008-04-17 23:42 ` eberlein at us dot ibm dot com 2008-04-18 7:34 ` vincent+libc at vinc17 dot org 2008-04-18 21:28 ` eberlein at us dot ibm dot com 2008-04-18 23:58 ` vincent+libc at vinc17 dot org [this message] 2008-04-19 0:08 ` sjmunroe at us dot ibm dot com 2008-06-05 17:53 ` khalil dot ghorbal at cea dot fr
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080418235810.26377.qmail@sourceware.org \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sources.redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).