summary refs log tree commit diff
path: root/stdio-common/printf_fp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-08 08:22:44 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-08 08:22:44 -0400
commit187da0aedcd9d0a2fb34477bef41549681ba1273 (patch)
treec531c8e708a728ff2b1ffc59fd5e27375f8d748c /stdio-common/printf_fp.c
parent9277c064373074aebbf1b6617c006f5985ec7938 (diff)
downloadglibc-187da0aedcd9d0a2fb34477bef41549681ba1273.tar.gz
glibc-187da0aedcd9d0a2fb34477bef41549681ba1273.tar.xz
glibc-187da0aedcd9d0a2fb34477bef41549681ba1273.zip
isinf returns the sign of the number, use it in printf*
Diffstat (limited to 'stdio-common/printf_fp.c')
-rw-r--r--stdio-common/printf_fp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 0a611470bc..0853bc296a 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -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";