This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

CYGWIN 2.3.0 [32/64]: strtold() seems to be broken


Hi newlib Developers,

Corinna Vinschen asked me to re-post my bug report here (which I sent
originally to the cygwin mailing list a few days ago).

So here we go (note that I have removed the "cygcheck.out" file, as this
seems to be a CYGWIN specific bug tracking process requirement only.
Please let me know if you expect me to send it or somthing similar to
this "newlib" mailing list as well):


strtold() seems to be broken, at least when there is additional
non-numeric data after the initial numeric part.

Code:

> #include <iostream>
> #include <stdlib.h>
> 
> int main()
> {
>   char* endptr;
>   const char * v = "1234abc";
>   const long double value = strtold(v, &endptr);
>   std::cout << v << " -> " << value << "\n";
> }

Linux (expected result):
> 1234abc -> 1234

CYGWIN (unexpected/wrong result):
> 1234abc -> -e+999

Note that using strtod() instead of strtold() on CYGWIN gives the
expected result. strtod() and strtold() implementations seem to differ
here.

The unexpected behaviuor can be seen on CYGWIN32 and CYGWIN64 for me.

BTW: There seem to be more strange things going on with strtold() on
CYGWIN32/64, see also:
https://stackoverflow.com/questions/29040427/unexpected-endptr-with-strtod-strtold
(tested today with recent CYGWIN, the reported inconsistency can still
be reproduced).

Thanks and best regards,

Tino


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