public inbox for ecos-bugs@sourceware.org help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org To: unassigned@bugs.ecos.sourceware.org Subject: [Bug 20804] Misbehavior of printf %e format. Date: Tue, 14 Aug 2012 08:31:00 -0000 [thread overview] Message-ID: <20120814083104.2BC402F7800E@mail.ecoscentric.com> (raw) In-Reply-To: <bug-20804-777@http.bugs.ecos.sourceware.org/> Please do not reply to this email. Use the web interface provided at: http://bugs.ecos.sourceware.org/show_bug.cgi?id=20804 Bernd Edlinger <bernd.edlinger@hotmail.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernd.edlinger@hotmail.de --- Comment #10 from Bernd Edlinger <bernd.edlinger@hotmail.de> 2012-08-14 09:31:01 BST --- (In reply to comment #9) > Created an attachment (id=1895) --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1895) [details] > printf() zero-padding issue fix > And may be just to expand a set of the arguments the cvt()? See the patch. > Then this > printf("%g %- 30.18e\n", 3.14e-11, 3.14e-11); > printf("%g %- 30.18f\n", 3.14e-11, 3.14e-11); > will output > 3.14e-11 3.140000000000001000e-11 > 3.14e-11 0.000000000031400000 > Sergei Hi Sergei, no. The buffer "buf" has only place for 308 characters. But fpprec can be any number. In my eyes the fpprec was invented to protect against the buffer overrun here. Probably there should be an output parameter, that indicates where the exponent is, and that could be used to print the mantissa, followed by fpprec zeros, followed by the exponent if any. Another limitation that I do not really like is, that the %.18f format does only print 15 digits, even if the number is very small. but the double has 16 digits precision. It is possible to fix that all together, but it is easy to introduce new bugs too. And one of the most important things in a function like sprintf, is that the stack usage should never increase what so ever. If you want, we can open a new bug for the next iteration of this issue. Bernd. -- Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.
next prev parent reply other threads:[~2012-08-14 8:31 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-20804-777@http.bugs.ecos.sourceware.org/> 2012-08-08 18:51 ` bugzilla-daemon 2012-08-09 10:58 ` bugzilla-daemon 2012-08-12 18:07 ` bugzilla-daemon 2012-08-13 20:58 ` bugzilla-daemon 2012-08-14 6:51 ` bugzilla-daemon 2012-08-14 7:41 ` bugzilla-daemon 2012-08-14 8:31 ` bugzilla-daemon [this message] 2012-08-14 8:50 ` bugzilla-daemon 2012-08-14 9:15 ` bugzilla-daemon 2012-08-14 10:48 ` bugzilla-daemon 2012-08-14 12:34 ` bugzilla-daemon [not found] <bug-20804-13@http.bugs.ecos.sourceware.org/> 2012-08-08 18:51 ` bugzilla-daemon 2012-08-09 10:58 ` bugzilla-daemon 2012-08-12 18:07 ` bugzilla-daemon 2012-08-13 20:58 ` bugzilla-daemon 2012-08-14 6:51 ` bugzilla-daemon 2012-08-14 7:41 ` bugzilla-daemon 2012-08-14 8:31 ` bugzilla-daemon 2012-08-14 8:50 ` bugzilla-daemon 2012-08-14 9:15 ` bugzilla-daemon 2012-08-14 10:48 ` bugzilla-daemon 2012-08-14 12:34 ` bugzilla-daemon [not found] <bug-20804-776@http.bugs.ecos.sourceware.org/> 2012-08-08 18:51 ` bugzilla-daemon
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=20120814083104.2BC402F7800E@mail.ecoscentric.com \ --to=bugzilla-daemon@bugs.ecos.sourceware.org \ --cc=unassigned@bugs.ecos.sourceware.org \ /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).