summaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-11-17 18:36:05 +0000
committerUlrich Drepper <drepper@redhat.com>1998-11-17 18:36:05 +0000
commitd8cceb4fcf42c9dd7805b75a8640e15d00dd7ac9 (patch)
tree2509bdf2a3563d5cddb03fb92b97c1dedee40ad2 /stdio-common
parentcae8899646b7acc7e5b27c14624a027f5240787f (diff)
Update.
1998-11-17 Ulrich Drepper <drepper@cygnus.com> * stdio-common/printf_fphex.c (__printf_fphex): Correct printing of denormalized numbers. 1998-10-06 Geoff Keating <geoffk@ozemail.com.au> * sysdeps/powerpc/dl-machine.h (elf_machine_load_address): Suppress another parentheses warning, make nano-optimisation. * sysdeps/powerpc/dl-machine.h (_dl_runtime_resolve): Preserve saved LR on stack so _mcount works. (_dl_prof_resolve): Likewise. * sysdeps/powerpc/register-dump.h: Print FPRs. Adjust for correct signal handler calling convention. * sysdeps/unix/sysv/linux/powerpc/sigcontextinfo.h: Adjust for correct signal handler calling convention---more like x86 linux and mklinux, less like linux-ppc versions between 2.1 and 2.1.126. 1998-11-17 Ulrich Drepper <drepper@cygnus.com> * configure.in: Correct allowed makeinfo version. 1998-11-17 Philip Blundell <pb@nexus.co.uk> * sysdeps/generic/bits/mathdef.h: Fix typo. * intl/locale.alias: Change `japanese' alias to match X11R6's.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/printf_fphex.c50
1 files changed, 35 insertions, 15 deletions
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
index 76084a8de5..4099bf2dd1 100644
--- a/stdio-common/printf_fphex.c
+++ b/stdio-common/printf_fphex.c
@@ -1,6 +1,6 @@
/* Print floating point number in hexadecimal notation according to
ISO C 9X.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -244,16 +244,26 @@ __printf_fphex (FILE *fp,
exponent = fpnum.dbl.ieee.exponent;
- if (exponent == 0 ? !zero_mantissa : exponent < IEEE754_DOUBLE_BIAS)
+ if (exponent == 0)
{
- expnegative = 1;
- exponent = -(exponent - IEEE754_DOUBLE_BIAS);
+ if (zero_mantissa)
+ expnegative = 0;
+ else
+ {
+ /* This is a denormalized number. */
+ expnegative = 1;
+ exponent = -(1 - IEEE754_DOUBLE_BIAS);
+ }
}
- else
+ else if (exponent >= IEEE754_DOUBLE_BIAS)
{
expnegative = 0;
- if (exponent != 0)
- exponent -= IEEE754_DOUBLE_BIAS;
+ exponent -= IEEE754_DOUBLE_BIAS;
+ }
+ else
+ {
+ expnegative = 1;
+ exponent = -(exponent - IEEE754_DOUBLE_BIAS);
}
}
else
@@ -282,20 +292,30 @@ __printf_fphex (FILE *fp,
/* We use a full nibble for the leading digit. */
leading = *numstr++;
- /* We have 3 bits from the mantissa in the leading nibble. */
+ /* We have 3 bits from the mantissa in the leading nibble.
+ Therefore we are here using `IEEE854_LONG_DOUBLE_BIAS + 3'. */
exponent = fpnum.ldbl.ieee.exponent;
- if (exponent == 0 ? !zero_mantissa
- : exponent < IEEE854_LONG_DOUBLE_BIAS + 3)
+ if (exponent == 0)
{
- expnegative = 1;
- exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3));
+ if (zero_mantissa)
+ expnegative = 0;
+ else
+ {
+ /* This is a denormalized number. */
+ expnegative = 1;
+ exponent = -(1 - (IEEE854_LONG_DOUBLE_BIAS + 3));
+ }
}
- else
+ else if (exponent >= IEEE854_LONG_DOUBLE_BIAS + 3)
{
expnegative = 0;
- if (exponent != 0)
- exponent -= IEEE854_LONG_DOUBLE_BIAS + 3;
+ exponent -= IEEE854_LONG_DOUBLE_BIAS + 2;
+ }
+ else
+ {
+ expnegative = 1;
+ exponent = -(exponent - (IEEE854_LONG_DOUBLE_BIAS + 3));
}
}