+2007-03-24 Bruno Haible <bruno@clisp.org>
+
+ * lib/float+.h: New file.
+ * lib/isnan.c: Include float+.h.
+ (SIZE): New macro.
+ (FUNC): Compare only SIZE bytes of the value.
+ * lib/vasnprintf.c: Include float+.h.
+ (VASNPRINTF): When comparing agains +0.0L or +0.0, compare only
+ SIZEOF_LDBL or SIZEOF_DBL bytes.
+ * modules/isnan-nolibm (Files): Add lib/float+.h.
+ * modules/isnanl-nolibm (Files): Add lib/float+.h.
+ * modules/isnanl (Files): Add lib/float+.h.
+ * modules/vasnprintf (Files): Add lib/float+.h.
+
2007-03-24 Bruno Haible <bruno@clisp.org>
* lib/vasnprintf.c [!HAVE_LONG_DOUBLE]: Include printf-frexp.h. Don't
#include <float.h>
#include <string.h>
+#include "float+.h"
+
#ifdef USE_LONG_DOUBLE
# define FUNC rpl_isnanl
# define DOUBLE long double
# define EXPBIT0_WORD LDBL_EXPBIT0_WORD
# define EXPBIT0_BIT LDBL_EXPBIT0_BIT
# endif
+# define SIZE SIZEOF_LDBL
# define L_(literal) literal##L
#else
# define FUNC rpl_isnan
# define EXPBIT0_WORD DBL_EXPBIT0_WORD
# define EXPBIT0_BIT DBL_EXPBIT0_BIT
# endif
+# define SIZE SIZEOF_DBL
# define L_(literal) literal
#endif
if (((m.word[EXPBIT0_WORD] ^ nan.word[EXPBIT0_WORD])
& (EXP_MASK << EXPBIT0_BIT))
== 0)
- return (memcmp (&m.value, &plus_inf, sizeof (DOUBLE)) != 0
- && memcmp (&m.value, &minus_inf, sizeof (DOUBLE)) != 0);
+ return (memcmp (&m.value, &plus_inf, SIZE) != 0
+ && memcmp (&m.value, &minus_inf, SIZE) != 0);
else
return 0;
}