Mercurial > hg > octave-lojdl > gnulib-hg
changeset 8529:5761935ad270
Correct bitwise comparison of 'long double' numbers.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 25 Mar 2007 01:11:49 +0000 |
parents | f25a6ce872b2 |
children | be99958bc9bc |
files | lib/vasnprintf.c |
diffstat | 1 files changed, 5 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ { /* 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 @@ { /* 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;