Using __USE_MINGW_ANSI_STDIO I would expect printf etc to follow what POSIX systems and MSVC2015+ do (see https://docs.microsoft.com/en-us/cpp/c-runtime-library/set-output-format) and only print two digits for the exponent if not more are required.
Example:
#define __USE_MINGW_ANSI_STDIO 1 #include <stdio.h> int main(void) { printf("%0.e\n", 1e99); return 0; }
Expected:
1e+99
Actual:
1e+099
The C11 standard (draft) says
So having more digits seems non-compliant behavior to me.
Read
mingw-w64-crt/stdio/mingw_pformat.c
onmaster
, line 186:Does this mean it's on purpose?
Yes.
OK. With _set_output_format gone and newer MSVC being C99 compliant for this case this seems to ge against the goals of __USE_MINGW_ANSI_STDIO imo.
Microsoft doc says the
_set_output_format()
function is no longer available since 2017 and now the default behavior outputs at least 2 digits for the exponent rather than 3. I think this should be changed. Looking forward to others' opinion.Last edit: LIU Hao 2018-05-06
Fixed on master.
Thank you!
https://sourceforge.net/p/mingw-w64/mingw-w64/ci/bcf1f29d6dc80b6025b416bef104d2314fa9be57/
Last edit: lazka 2018-05-06