printf("%a", ...) produces incorrect output for some numbers.
In particular, it seems to be broken for numbers smaller than the smallest normalized single-precision floating-point number.
I originally saw this using MinGW runtime 3.15.2 and 3.18.0 has the same problem.
Build the test case using gcc -Wall -std=c99 printf-a-bug.c.
When run, it will print:
where the second line _should_ read 0x1p-126 (or equivalent).
Log in to post a comment.