From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26932 invoked by alias); 14 Aug 2012 08:31:24 -0000 Received: (qmail 26900 invoked by uid 22791); 14 Aug 2012 08:31:20 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,SARE_SUB_PCT_LETTER X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Aug 2012 08:31:08 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id 807912F7800B for ; Tue, 14 Aug 2012 09:31:07 +0100 (BST) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oj40O5HYYzqn; Tue, 14 Aug 2012 09:31:05 +0100 (BST) From: bugzilla-daemon@bugs.ecos.sourceware.org To: ecos-bugs@ecos.sourceware.org Subject: [Bug 20804] Misbehavior of printf %e format. X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: C library X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bernd.edlinger@hotmail.de X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: 2.0 Final X-Bugzilla-Changed-Fields: CC In-Reply-To: References: X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 14 Aug 2012 08:31:00 -0000 Message-Id: <20120814083104.484B52F7800F@mail.ecoscentric.com> Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-bugs-owner@sourceware.org X-SW-Source: 2012/txt/msg01192.txt.bz2 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 changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernd.edlinger@hotmail.de --- Comment #10 from Bernd Edlinger 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 on the CC list for the bug.