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/4061] New: strtod converts hex floating point to incorrect value


strtod convers 0x100p-7 to an incorrect value -- the value should be 2 but it returns 0.03125. This 
was tested on a GNU/Linux Gentoo Box, kernel version 2.6.17.6, gcc version 4.1.1 and libc version 2.4. 
The following code reproductes the results:

#include <stdio.h>
#include <stdlib.h>
#include <gnu/libc-version.h>

main() {
        long double a=strtod("0x100p-7",0);
        printf("0x100p-7 is 2, not %Lg\n",a);
        printf("libc version: %s\n",gnu_get_libc_version ());
}

output:  
0x100p-7 is 2, not 0.03125
libc version: 2.4

-- 
           Summary: strtod converts hex floating point to incorrect value
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: deianstefan at gmail dot com
                CC: glibc-bugs at sources dot redhat dot com,stefan at
                    cooper dot edu


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

------- 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]