From: Bruno Haible Date: Sun, 25 Mar 2007 01:11:49 +0000 (+0000) Subject: Correct bitwise comparison of 'long double' numbers. X-Git-Tag: cvs-readonly~689 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=555acda4637f118f03f674071b8199eac1e9e0f2;p=gnulib.git Correct bitwise comparison of 'long double' numbers. --- diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index bc80b444a..00419aaaa 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -51,6 +51,7 @@ #include "xsize.h" #if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL +# include "float+.h" # include "isnan.h" # include "printf-frexp.h" # if HAVE_LONG_DOUBLE @@ -424,10 +425,8 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar { /* Distinguish 0.0L and -0.0L. */ static long double plus_zero = 0.0L; - long double arg_mem; - memset (&arg_mem, 0, sizeof (long double)); - arg_mem = arg; - if (memcmp (&plus_zero, &arg_mem, sizeof (long double)) != 0) + long double arg_mem = arg; + if (memcmp (&plus_zero, &arg_mem, SIZEOF_LDBL) != 0) { sign = -1; arg = -arg; @@ -574,10 +573,8 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar { /* Distinguish 0.0 and -0.0. */ static double plus_zero = 0.0; - double arg_mem; - memset (&arg_mem, 0, sizeof (double)); - arg_mem = arg; - if (memcmp (&plus_zero, &arg_mem, sizeof (double)) != 0) + double arg_mem = arg; + if (memcmp (&plus_zero, &arg_mem, SIZEOF_DBL) != 0) { sign = -1; arg = -arg;