+2007-04-06 Bruno Haible <bruno@clisp.org>
+
+ * lib/vasnprintf.c: Include <math.h>. Don't include float+.h.
+ (VASNPRINTF): Use signbit for faster determination whether to print a
+ minus sign.
+ * modules/vasnprintf (Files): Remove lib/float+.h.
+ * modules/fprintf-posix (Depends-on): Add signbit.
+ * modules/snprintf-posix (Depends-on): Likewise.
+ * modules/sprintf-posix (Depends-on): Likewise.
+ * modules/vasnprintf-posix (Depends-on): Likewise.
+ * modules/vasprintf-posix (Depends-on): Likewise.
+ * modules/vfprintf-posix (Depends-on): Likewise.
+ * modules/vsnprintf-posix (Depends-on): Likewise.
+ * modules/vsprintf-posix (Depends-on): Likewise.
+
2007-04-06 Bruno Haible <bruno@clisp.org>
* tests/test-frexp.c (main): Test also the sign bit of zero results.
#include "xsize.h"
#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
-# include "float+.h"
+# include <math.h>
# include "isnan.h"
# include "printf-frexp.h"
# include "isnanl-nolibm.h"
BEGIN_LONG_DOUBLE_ROUNDING ();
- if (arg < 0.0L)
+ if (signbit (arg)) /* arg < 0.0L or negative zero */
{
sign = -1;
arg = -arg;
}
- else if (arg == 0.0L)
- {
- /* Distinguish 0.0L and -0.0L. */
- static long double plus_zero = 0.0L;
- long double arg_mem = arg;
- if (memcmp (&plus_zero, &arg_mem, SIZEOF_LDBL) != 0)
- {
- sign = -1;
- arg = -arg;
- }
- }
if (sign < 0)
*p++ = '-';
{
int sign = 0;
- if (arg < 0.0)
+ if (signbit (arg)) /* arg < 0.0 or negative zero */
{
sign = -1;
arg = -arg;
}
- else if (arg == 0.0)
- {
- /* Distinguish 0.0 and -0.0. */
- static double plus_zero = 0.0;
- double arg_mem = arg;
- if (memcmp (&plus_zero, &arg_mem, SIZEOF_DBL) != 0)
- {
- sign = -1;
- arg = -arg;
- }
- }
if (sign < 0)
*p++ = '-';