[Cfp-interest 1693] printf with %a

Fred J. Tydeman tydeman at tybor.com
Fri Jul 17 08:57:29 PDT 2020


Is
 printf("%-+#.0La", 3.0L);
allowed to output  "+0x2.p+1"
instead of "+0x3.p+1"
for IEEE-754 binary floating-point?

C 7.21.6.1#11 has:
For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded to a hexadecimal
floating number with the given precision.


---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.



More information about the Cfp-interest mailing list