X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=0.8 required=5.0	tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE,REPTO_QUOTE_YAHOO,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
X-Rocket-MIMEInfo: 001.001,VGhlIGZvbGxvd2luZyBjb2RlIGRlbW9uc3RyYXRlcyBhIHN1YnRsZSBidWcgaW4gdGhlIEN5Z3dpbiB2ZXJzaW9uIG9mIHN0cnRvZCgpLiBUaGUgdmFsdWUgaXQgZ2VuZXJhdGVzIGlzIHNsaWdodGx5IGRpZmZlcmVudCB0aGFuIHRoZSB2YWx1ZSB3aGVuIHVzaW5nIHRoZSBtYXRoIGhlYWRlciBmaWxlcy4gVGhpcyB1c2VkIHRvIHdvcmsgY29ycmVjdGx5IHNvbWUgdGltZSBhZ28gKG1vbnRocykuIEkganVzdCB0b29rIHRoZSB0aW1lIHRvIHRyYWNrIHRoZSBwcm9ibGVtIGRvd24gaW4gb3VyIHJlZ3Jlc3Npb24BMAEBAQE-
Message-ID: <1355878473.91036.YahooMailNeo@web121001.mail.ne1.yahoo.com>
Date: Tue, 18 Dec 2012 16:54:33 -0800 (PST)
From: "Cary R." <cygcary@yahoo.com>
Reply-To: "Cary R." <cygcary@yahoo.com>
Subject: Bug in Cygwin strtod()
To: "cygwin@cygwin.com" <cygwin@cygwin.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
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
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id qBJ0vRsM005967

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


This code does produce the expected output under Linux and when using the MinGW compilers.

Cary


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


