* m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Test for Mac OS X 10.12 bug.
* doc/posix-functions/*printf.texi: Mention the rounding bugs of
Mac OS X and FreeBSD.
* doc/glibc-functions/*printf.texi: Likewise.
+2017-04-22 Bruno Haible <bruno@clisp.org>
+
+ *printf: Work around rounding bug on Mac OS X.
+ * m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Test for Mac OS X 10.12 bug.
+ * doc/posix-functions/*printf.texi: Mention the rounding bugs of
+ Mac OS X and FreeBSD.
+ * doc/glibc-functions/*printf.texi: Likewise.
+
2017-04-22 Bruno Haible <bruno@clisp.org>
vasnprintf tests: Avoid warnings.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
with zeroes) on some platforms:
Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, Solaris 11 2011-11, Cygwin 1.5.x.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
printf @code{"%010f"} of NaN and Infinity yields an incorrect result (padded
with zeroes) on some platforms:
Mac OS X 10.5, FreeBSD 6.0, NetBSD 5.0, Solaris 11 2011-11, Cygwin 1.5.x.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
This function doesn't support the @code{'} flag on some platforms:
NetBSD 3.0, Cygwin 1.5.24, mingw, MSVC 9.
@item
+This function does not round the argument of the @samp{a} directive correctly
+on some platforms:
+Mac OS X 10.12, FreeBSD 6.1.
+@item
This function behaves incorrectly when a @samp{-} flag and a negative width
are specified together, on some platforms:
HP-UX 10.20.
-# printf.m4 serial 52
+# printf.m4 serial 53
dnl Copyright (C) 2003, 2007-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
&& strcmp (buf, "0x6.0ap-2 33") != 0
&& strcmp (buf, "0xc.14p-3 33") != 0))
result |= 4;
+ /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */
+ if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0
+ || (strcmp (buf, "0x2p+0 33") != 0
+ && strcmp (buf, "0x3p-1 33") != 0
+ && strcmp (buf, "0x6p-2 33") != 0
+ && strcmp (buf, "0xcp-3 33") != 0))
+ result |= 4;
/* This catches a FreeBSD 6.1 bug. See
<http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0