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

Reply via email to