From 187da0aedcd9d0a2fb34477bef41549681ba1273 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 8 Oct 2011 08:22:44 -0400 Subject: isinf returns the sign of the number, use it in printf* --- stdio-common/printf_fphex.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'stdio-common/printf_fphex.c') diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c index 284cc6e..6cb7141 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); } } -- cgit v1.1