delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/12/19/03:42:37

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 19 Dec 2012 09:42:01 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Bug in Cygwin strtod()
Message-ID: <20121219084201.GA12840@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <1355878473 DOT 91036 DOT YahooMailNeo AT web121001 DOT mail DOT ne1 DOT yahoo DOT com> <50D118CE DOT 8090108 AT gmail DOT com> <50D166D2 DOT 3030505 AT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <50D166D2.3030505@gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Dec 19 08:03, marco atzeri wrote:
> On 12/19/2012 2:30 AM, KHMan wrote:
> >On 12/19/2012 8:54 AM, Cary R. wrote:
> >>The following code demonstrates a subtle bug in the Cygwin version of
> >>strtod(). The value it generates is slightly different than the value
> >>when using the math header files. This used to work correctly some
> >>time ago (months). I just took the time to track the problem down in
> >>our regression suite.
> >>
> >>#include<math.h>
> >>#include<stdio.h>
> >>#include<stdlib.h>
> >>
> >>int main()
> >>{
> >>     double value = M_LN10;
> >>
> >>     printf("generate const. - value: %0.15f.\n", value);
> >>     printf("expected const. - value: 2.302585092994046.\n");
> >>
> >>     printf("\n");
> >>     value = strtod("2.30258509299404568402", 0);
> >>
> >>     /* Note: the last digit is incorrect. */
> >>     printf("generate strtod - value: %0.15f.\n", value);
> >>     printf("expected strtod - value: 2.302585092994046.\n");
> >>
> >>     return 0;
> >>}
> >
> >Yep, looks like the significand misses its mark by 1.
> >
> 
> strtod is from newlib.
> the last change in the code is one year and half ago
> 
> http://sourceware.org/cgi-bin/cvsweb.cgi/src/newlib/libc/stdlib/strtod.c.diff?r1=1.17&r2=1.18&cvsroot=src

...and this change also introduced the problem.  I'll look into it.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019