about summary refs log tree commit diff
path: root/stdio-common/printf_fphex.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_fphex.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_fphex.c')
-rw-r--r--stdio-common/printf_fphex.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index 284cc6eec5..6cb71414f5 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -180,7 +180,8 @@ __printf_fphex (FILE *fp,
 	}
       else
 	{
-	  if (__isinfl (fpnum.ldbl.d))
+	  int res = __isinfl (fpnum.ldbl.d);
+	  if (res)
 	    {
 	      if (isupper (info->spec))
 		{
@@ -192,9 +193,10 @@ __printf_fphex (FILE *fp,
 		  special = "inf";
 		  wspecial = L"inf";
 		}
+	      negative = res < 0;
 	    }
-
-	  negative = signbit (fpnum.ldbl.d);
+	  else
+	    negative = signbit (fpnum.ldbl.d);
 	}
     }
   else
@@ -219,7 +221,8 @@ __printf_fphex (FILE *fp,
 	}
       else
 	{
-	  if (__isinf (fpnum.dbl.d))
+	  int res = __isinf (fpnum.dbl.d);
+	  if (res)
 	    {
 	      if (isupper (info->spec))
 		{
@@ -231,9 +234,10 @@ __printf_fphex (FILE *fp,
 		  special = "inf";
 		  wspecial = L"inf";
 		}
+	      negative = res < 0;
 	    }
-
-	  negative = signbit (fpnum.dbl.d);
+	  else
+	    negative = signbit (fpnum.dbl.d);
 	}
     }