This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/4342] New: scanf %lg problem with hex numbers


scanf makes exponents specifiers mandatory whereas it should not. The code to 
reproduce the problem is:



#include <stdio.h>

int
main (void)
{
    double d = -999;
    int  ret;

    ret =  sscanf ("0x100", "%lg", &d);
    printf ("%d %g\n", ret, d);

    ret =  sscanf ("0x100p0", "%lg", &d);
    printf ("%d %g\n", ret, d);

    return 0;
}


expected output would be:
1 256
1 256

it gives currently:
0 -999
1 256

-- 
           Summary: scanf %lg problem with hex numbers
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: madcoder at debian dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4342

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]