1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

isinf returns the sign of the number, use it in printf*

This commit is contained in:
Ulrich Drepper
2011-10-08 08:22:44 -04:00
parent 9277c06437
commit 187da0aedc
4 changed files with 32 additions and 23 deletions

View File

@@ -334,6 +334,7 @@ ___printf_fp (FILE *fp,
fpnum.ldbl = *(const long double *) args[0];
/* Check for special values: not a number or infinity. */
int res;
if (__isnanl (fpnum.ldbl))
{
union ieee854_long_double u = { .d = fpnum.ldbl };
@@ -349,9 +350,9 @@ ___printf_fp (FILE *fp,
wspecial = L"nan";
}
}
else if (__isinfl (fpnum.ldbl))
else if ((res = __isinfl (fpnum.ldbl)))
{
is_neg = fpnum.ldbl < 0;
is_neg = res < 0;
if (isupper (info->spec))
{
special = "INF";
@@ -379,6 +380,7 @@ ___printf_fp (FILE *fp,
fpnum.dbl = *(const double *) args[0];
/* Check for special values: not a number or infinity. */
int res;
if (__isnan (fpnum.dbl))
{
union ieee754_double u = { .d = fpnum.dbl };
@@ -394,9 +396,9 @@ ___printf_fp (FILE *fp,
wspecial = L"nan";
}
}
else if (__isinf (fpnum.dbl))
else if ((res = __isinf (fpnum.dbl)))
{
is_neg = fpnum.dbl < 0;
is_neg = res < 0;
if (isupper (info->spec))
{
special = "INF";