bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vasnprintf(-0.0L) on Irix [was: snapshot in preparation for m4 1.4.1


From: Bruno Haible
Subject: Re: vasnprintf(-0.0L) on Irix [was: snapshot in preparation for m4 1.4.12]
Date: Thu, 18 Sep 2008 12:34:55 +0200
User-agent: KMail/1.5.4

Eric Blake wrote:
> with both pieces in place, I've tested that Irix 5.3 
> passes the testsuite.  So here's what I'm pushing:
> 
> From: Eric Blake <address@hidden>
> Date: Tue, 16 Sep 2008 09:36:24 -0600
> Subject: [PATCH] vasnprintf: support Irix 5.3
> 
> * lib/vasnprintf.c (VASNPRINTF): Also handle -0.0L on platforms
> that mishandle long double infinity.
> Reported by Tom G. Christensen.

Thanks. Jim noticed that this new code branch requires the decimal_point_char
function to be defined. Also, the handling of ±0.0L in the case
NEED_PRINTF_INFINITE_LONG_DOUBLE && !NEED_PRINTF_LONG_DOUBLE
should be the same as in the case NEED_PRINTF_LONG_DOUBLE. I'm applying this
to make it consistent. (You apparently copied the code for 'double'. In the
'double' case on mingw, in 'e' format, we need to use 3 digits for the
exponent, to match what MSVCRT does. This is not needed for 'long double' -
since 'long double' output is not supported by MSVCRT in the first place.)


2008-09-18  Bruno Haible  <address@hidden>

        * lib/vasnprintf.c (decimal_point_char): Define also if
        NEED_PRINTF_INFINITE_LONG_DOUBLE.
        (VASNPRINTF): When printing ±0.0L in NEED_PRINTF_INFINITE_LONG_DOUBLE
        case with 'e' format, always use two digits for the exponent.
        Reported by Jim Meyering.

--- lib/vasnprintf.c.orig       2008-09-18 12:32:43.000000000 +0200
+++ lib/vasnprintf.c    2008-09-18 12:22:04.000000000 +0200
@@ -215,7 +215,7 @@
 #undef remainder
 #define remainder rem
 
-#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || NEED_PRINTF_DOUBLE 
|| NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
+#if (NEED_PRINTF_DIRECTIVE_A || NEED_PRINTF_LONG_DOUBLE || 
NEED_PRINTF_INFINITE_LONG_DOUBLE || NEED_PRINTF_DOUBLE || 
NEED_PRINTF_INFINITE_DOUBLE) && !defined IN_LIBINTL
 /* Determine the decimal-point character according to the current locale.  */
 # ifndef decimal_point_char_defined
 #  define decimal_point_char_defined 1
@@ -3167,11 +3167,6 @@
                                  }
                                *p++ = dp->conversion; /* 'e' or 'E' */
                                *p++ = '+';
-                               /* Produce the same number of exponent digits as
-                                  the native printf implementation.  */
-#   if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-                               *p++ = '0';
-#   endif
                                *p++ = '0';
                                *p++ = '0';
                              }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]