[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
use signbit for vasnprintf
From: |
Bruno Haible |
Subject: |
use signbit for vasnprintf |
Date: |
Fri, 6 Apr 2007 23:21:07 +0200 |
User-agent: |
KMail/1.5.4 |
This makes use of the signbit macro in the vasnprintf module, as proposed by
Paul.
2007-04-06 Bruno Haible <address@hidden>
* 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.
*** lib/vasnprintf.c 6 Apr 2007 14:36:56 -0000 1.38
--- lib/vasnprintf.c 6 Apr 2007 21:15:59 -0000
***************
*** 54,60 ****
#include "xsize.h"
#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
! # include "float+.h"
# include "isnan.h"
# include "printf-frexp.h"
# include "isnanl-nolibm.h"
--- 54,60 ----
#include "xsize.h"
#if NEED_PRINTF_DIRECTIVE_A && !defined IN_LIBINTL
! # include <math.h>
# include "isnan.h"
# include "printf-frexp.h"
# include "isnanl-nolibm.h"
***************
*** 445,466 ****
BEGIN_LONG_DOUBLE_ROUNDING ();
! if (arg < 0.0L)
{
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++ = '-';
--- 445,455 ----
BEGIN_LONG_DOUBLE_ROUNDING ();
! if (signbit (arg)) /* arg < 0.0L or negative zero */
{
sign = -1;
arg = -arg;
}
if (sign < 0)
*p++ = '-';
***************
*** 590,611 ****
{
int sign = 0;
! if (arg < 0.0)
{
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++ = '-';
--- 579,589 ----
{
int sign = 0;
! if (signbit (arg)) /* arg < 0.0 or negative zero */
{
sign = -1;
arg = -arg;
}
if (sign < 0)
*p++ = '-';
*** modules/fprintf-posix 25 Mar 2007 02:30:04 -0000 1.2
--- modules/fprintf-posix 6 Apr 2007 21:15:59 -0000
***************
*** 14,19 ****
--- 14,20 ----
isnanl-nolibm
printf-frexp
printf-frexpl
+ signbit
fpucw
configure.ac:
*** modules/snprintf-posix 25 Mar 2007 02:30:04 -0000 1.2
--- modules/snprintf-posix 6 Apr 2007 21:15:59 -0000
***************
*** 13,18 ****
--- 13,19 ----
isnanl-nolibm
printf-frexp
printf-frexpl
+ signbit
fpucw
configure.ac:
*** modules/sprintf-posix 25 Mar 2007 02:30:04 -0000 1.2
--- modules/sprintf-posix 6 Apr 2007 21:15:59 -0000
***************
*** 13,18 ****
--- 13,19 ----
isnanl-nolibm
printf-frexp
printf-frexpl
+ signbit
fpucw
configure.ac:
*** modules/vasnprintf 6 Apr 2007 14:36:56 -0000 1.14
--- modules/vasnprintf 6 Apr 2007 21:15:59 -0000
***************
*** 6,12 ****
lib/printf-args.c
lib/printf-parse.h
lib/printf-parse.c
- lib/float+.h
lib/vasnprintf.h
lib/vasnprintf.c
lib/asnprintf.c
--- 6,11 ----
*** modules/vasnprintf-posix 25 Mar 2007 02:30:04 -0000 1.2
--- modules/vasnprintf-posix 6 Apr 2007 21:15:59 -0000
***************
*** 12,17 ****
--- 12,18 ----
isnanl-nolibm
printf-frexp
printf-frexpl
+ signbit
fpucw
configure.ac:
*** modules/vasprintf-posix 25 Mar 2007 02:30:04 -0000 1.2
--- modules/vasprintf-posix 6 Apr 2007 21:15:59 -0000
***************
*** 12,17 ****
--- 12,18 ----
isnanl-nolibm
printf-frexp
printf-frexpl
+ signbit
fpucw
configure.ac:
*** modules/vfprintf-posix 25 Mar 2007 02:30:04 -0000 1.2
--- modules/vfprintf-posix 6 Apr 2007 21:15:59 -0000
***************
*** 14,19 ****
--- 14,20 ----
isnanl-nolibm
printf-frexp
printf-frexpl
+ signbit
fpucw
configure.ac:
*** modules/vsnprintf-posix 25 Mar 2007 02:30:04 -0000 1.2
--- modules/vsnprintf-posix 6 Apr 2007 21:15:59 -0000
***************
*** 13,18 ****
--- 13,19 ----
isnanl-nolibm
printf-frexp
printf-frexpl
+ signbit
fpucw
configure.ac:
*** modules/vsprintf-posix 25 Mar 2007 02:30:04 -0000 1.2
--- modules/vsprintf-posix 6 Apr 2007 21:15:59 -0000
***************
*** 13,18 ****
--- 13,19 ----
isnanl-nolibm
printf-frexp
printf-frexpl
+ signbit
fpucw
configure.ac:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- use signbit for vasnprintf,
Bruno Haible <=