在 2020/1/8 上午6:53, David Mathog 写道: > Am I using errno improperly for mingw64 (maybe some Windows variant is > needed instead?) or is there some other issue in play? >
It seems like a bug. `strtodf()` is implemented in 'mingw-w64-crt/stdio/strtof.c' which just calls `strtod()`. This is wrong for two reasons. One is that it doesn't handle overflows correctly as in your example. The other is that this suffers from double rounding errors (conversion from "0x0.8000017FFFFFFF" to `double` then casting the result to `float` yields a different result from a direct conversion). Perhaps this simple wrapper exists only because MSVCRT doesn't export `strtof()`. In my opinion we should forward to `__strtof()` instead which is defined in 'mingw-w64-crt/gdtoa/strtof.c'. -- Best regards, LH_Mouse
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public