This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/4061] New: strtod converts hex floating point to incorrect value
- From: "deianstefan at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 16 Feb 2007 08:27:22 -0000
- Subject: [Bug libc/4061] New: strtod converts hex floating point to incorrect value
- Reply-to: sourceware-bugzilla at sourceware dot org
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.