[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: snapshot in preparation for m4 1.4.12
From: |
Bruno Haible |
Subject: |
Re: snapshot in preparation for m4 1.4.12 |
Date: |
Sat, 13 Sep 2008 19:05:38 +0200 |
User-agent: |
KMail/1.5.4 |
Eric Blake wrote:
> Tom has (graciously) allowed me access to his Irix 5.3 system to attempt
> to address this.
Thanks for debugging this!
> > The test ends up calling sprintf(tmp, "%Ld", -0.0L), but
>
> excuse the typo; I meant "%Lf", not "%Ld"
>
> > the system sprintf does not know how to print -0, so the result is
> > 0.000000 and lacks -. Does it make more sense to adjust the existing
> > gl_PRINTF_INFINITE_LONG_DOUBLE (which also tests for NaN) to add a test
> > for negative zero, or to add a new macro gl_PRINTF_ZERO_LONG_DOUBLE?
Based on this info, I would have recommended to add a separate test to
m4/printf.m4, for clarity; however, in vasnprintf.m4 there are enough
#ifdefs, therefore I would simply have defined NEED_PRINTF_INFINITE_LONG_DOUBLE.
> At any rate, the Irix box also failed the infinite long double test, so it
> already has problem with inf and/or NaN, and the place to add code for
> -0.0 should be relatively easy to locate.
In this situation, m4/printf.m4 needs no changes at all. Find here a
proposed fix:
Bruno
--- lib/vasnprintf.c.orig 2008-09-13 19:02:12.000000000 +0200
+++ lib/vasnprintf.c 2008-09-13 19:01:42.000000000 +0200
@@ -255,11 +255,11 @@
#if NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE && !defined
IN_LIBINTL
-/* Equivalent to !isfinite(x), but does not require libm. */
+/* Equivalent to !isfinite(x) || x == 0, but does not require libm. */
static int
-is_infinitel (long double x)
+is_infinite_or_zerol (long double x)
{
- return isnanl (x) || (x + x == x && x != 0.0L);
+ return isnanl (x) || x + x == x;
}
#endif
@@ -2578,8 +2578,10 @@
# elif NEED_PRINTF_INFINITE_LONG_DOUBLE
|| (a.arg[dp->arg_index].type == TYPE_LONGDOUBLE
/* Some systems produce wrong output for Inf,
- -Inf, and NaN. */
- && is_infinitel
(a.arg[dp->arg_index].a.a_longdouble))
+ -Inf, and NaN. Some systems in this category
+ (IRIX 5.3) also do so for -0.0. Therefore we
+ treat this case here as well. */
+ && is_infinite_or_zerol
(a.arg[dp->arg_index].a.a_longdouble))
# endif
))
{
- Re: snapshot in preparation for m4 1.4.12, Eric Blake, 2008/09/12
- Re: snapshot in preparation for m4 1.4.12, Eric Blake, 2008/09/13
- Re: snapshot in preparation for m4 1.4.12, Eric Blake, 2008/09/13
- Re: snapshot in preparation for m4 1.4.12,
Bruno Haible <=
- vasnprintf(-0.0L) on Irix [was: snapshot in preparation for m4 1.4.12], Eric Blake, 2008/09/16
- Re: vasnprintf(-0.0L) on Irix [was: snapshot in preparation for m4 1.4.12], Bruno Haible, 2008/09/18
- Re: vasnprintf(-0.0L) on Irix [was: snapshot in preparation for m4 1.4.12], Eric Blake, 2008/09/20
- Re: vasnprintf(-0.0L) on Irix [was: snapshot in preparation for m4 1.4.12], Bruno Haible, 2008/09/21
- Re: mingw, Bruno Haible, 2008/09/21