From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10958 invoked by alias); 29 Apr 2008 18:00:04 -0000 Received: (qmail 9832 invoked by uid 48); 29 Apr 2008 17:59:08 -0000 Date: Tue, 29 Apr 2008 18:00:00 -0000 From: "eberlein at us dot ibm dot com" To: glibc-bugs@sources.redhat.com Message-ID: <20080429175907.6467.eberlein@us.ibm.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/6467] New: strtod "0.0" returns nonzero X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2008-04/txt/msg00157.txt.bz2 Consider the following code snippet. printf("%g", strtof("0.0", NULL)) printf("%lg", strtod("0.0", NULL)) printf("%llg", strtold("0.0", NULL)) When executed, expecting to see zeroes, the output is: 2.216671e-231 2.216671e-231 2.216671e-231 This seems to be due to strtod_l.c setting int_no is 0 lead_zero = -1 and later dig_no -= lead_zero This increases the number of digits considered for fractional digits since dig_no - int_no is passed to str_to_mpn. This causes the null string terminator to be considered as a digit in the fractional digits. -- Summary: strtod "0.0" returns nonzero Product: glibc Version: 2.4 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: eberlein at us dot ibm dot com CC: glibc-bugs at sources dot redhat dot com http://sourceware.org/bugzilla/show_bug.cgi?id=6467 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.