Launchpad has imported 6 comments from the remote bug at
http://sourceware.org/bugzilla/show_bug.cgi?id=4858.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2007-07-27T18:47:33+00:00 Wirawan Purwanto wrote:

Please use the following testcase:

#include <stdio.h>
int main(int argc, char *argv[], char *env[])
{
    printf("%#.4g\n", 912.98);
    return 0;
}

This code should print "913.0", but instead it only prints "913." . It lacks the
trailing zeros, which should be there according to the standard C specs.

I believe that this bug is reproducible on the stock version of glibc 2.6 . I
have established the bug by building the 2.6 library on my local machine, then
linking the program above against the newly built libc.a .

Reply at: https://bugs.launchpad.net/glibc/+bug/128355/comments/2

------------------------------------------------------------------------
On 2007-07-27T20:10:07+00:00 Jakub Jelinek wrote:

This is a regression caused by the BZ#4070 fix, particularly the
+           else if (__builtin_expect (spec == 'g' && type == 'f' && info->alt,
+                                      0))
+             /* This is a special case: the rounded number is 1.0,
+                the format is 'g' or 'G', and the alternative format
+                is selected.  This means the result must be "1.".  */
+             --added_zeros;
hunk.  It is IMHO only valid when the the integral part is all nines (or empty),
i.e. when we'll need more int digits, but we don't know this at this point.
For the "%#.0g", 0.956 case which got fixes that is true and similarly for
"%#.4g", 999.98, but not for this "%#.4g", 912.98.

Reply at: https://bugs.launchpad.net/glibc/+bug/128355/comments/4

------------------------------------------------------------------------
On 2007-07-29T00:26:36+00:00 Drepper-fsp wrote:

Fixed in cvs.

Reply at: https://bugs.launchpad.net/glibc/+bug/128355/comments/5

------------------------------------------------------------------------
On 2007-07-31T02:06:08+00:00 Drepper-fsp wrote:

*** Bug 4869 has been marked as a duplicate of this bug. ***

Reply at: https://bugs.launchpad.net/glibc/+bug/128355/comments/7

------------------------------------------------------------------------
On 2007-07-31T12:43:00+00:00 Cvs-commit wrote:

Subject: Bug 4858

CVSROOT:        /cvs/glibc
Module name:    libc
Branch:         glibc-2_6-branch
Changes by:     [email protected]    2007-07-31 12:42:39

Modified files:
        .              : ChangeLog 
        stdio-common   : printf_fp.c tfformat.c 

Log message:
        2007-07-31  Jakub Jelinek  <[email protected]>
        
        * stdio-common/tfformat.c (sprint_doubles): Add 12 new tests.
        
        2007-07-28  Ulrich Drepper  <[email protected]>
        
        [BZ #4858]
        * stdio-common/printf_fp.c (___printf_fp): Fix special case of
        #.0g and value rounded to 1.0.
        * stdio-common/tfformat.c (sprint_doubles): Add two new tests.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/ChangeLog.diff?cvsroot=glibc&only_with_tag=glibc-2_6-branch&r1=1.10640.2.1&r2=1.10640.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/stdio-common/printf_fp.c.diff?cvsroot=glibc&only_with_tag=glibc-2_6-branch&r1=1.63&r2=1.63.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/stdio-common/tfformat.c.diff?cvsroot=glibc&only_with_tag=glibc-2_6-branch&r1=1.10&r2=1.10.2.1


Reply at: https://bugs.launchpad.net/glibc/+bug/128355/comments/8

------------------------------------------------------------------------
On 2007-07-31T12:44:40+00:00 Cvs-commit wrote:

Subject: Bug 4858

CVSROOT:        /cvs/glibc
Module name:    libc
Branch:         glibc-2_5-branch
Changes by:     [email protected]    2007-07-31 12:44:28

Modified files:
        .              : ChangeLog 
        stdio-common   : printf_fp.c tfformat.c 

Log message:
        2007-07-31  Jakub Jelinek  <[email protected]>
        
        * stdio-common/tfformat.c (sprint_doubles): Add 12 new tests.
        
        2007-07-28  Ulrich Drepper  <[email protected]>
        
        [BZ #4858]
        * stdio-common/printf_fp.c (___printf_fp): Fix special case of
        #.0g and value rounded to 1.0.
        * stdio-common/tfformat.c (sprint_doubles): Add two new tests.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/ChangeLog.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.10362.2.96&r2=1.10362.2.97
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/stdio-common/printf_fp.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.58.2.3&r2=1.58.2.4
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/stdio-common/tfformat.c.diff?cvsroot=glibc&only_with_tag=glibc-2_5-branch&r1=1.7.8.2&r2=1.7.8.3


Reply at: https://bugs.launchpad.net/glibc/+bug/128355/comments/9


** Changed in: glibc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/128355

Title:
  libc6 printf "alternate format" %#.g prints wrong number of digits

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to