X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-5.9 required=5.0	tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
X-Received: by 10.66.79.163 with SMTP id k3mr12038828pax.60.1355880661424;        Tue, 18 Dec 2012 17:31:01 -0800 (PST)
Message-ID: <50D118CE.8090108@gmail.com>
Date: Wed, 19 Dec 2012 09:30:54 +0800
From: KHMan <keinhong@gmail.com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Bug in Cygwin strtod()
References: <1355878473.91036.YahooMailNeo@web121001.mail.ne1.yahoo.com>
In-Reply-To: <1355878473.91036.YahooMailNeo@web121001.mail.ne1.yahoo.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

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.

-- 
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia

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

