This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in Cygwin strtod()

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.


int main()
     double value = M_LN10;

     printf("generate const. - value: %0.15f.\n", value);
     printf("expected const. - value: 2.302585092994046.\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

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]