a bug in printf %a

Bruno Haible bruno at clisp.org
Fri Apr 6 02:07:23 UTC 2007


sprintf (buf, "%.2a", 1.51)
should produce "0x1.83p+0". On FreeBSD it produces "0x1.82p+0", which is
incorrect since [1] says:
   "For the a and A conversion specifiers, if FLT_RADIX is a power of 2, the
    value shall be correctly rounded to a hexadecimal floating number with
    the given precision."

[1] http://www.opengroup.org/susv3/functions/fprintf.html
[2] http://article.gmane.org/gmane.comp.lib.gnulib.bugs/10034



More information about the freebsd-standards mailing list