summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-06-04 14:38:22 +0000
committerUlrich Drepper <drepper@redhat.com>2007-06-04 14:38:22 +0000
commit43b768284325b7e7d2ec3fc3dcac13a35c378c95 (patch)
tree6560de64681e4f69ea9936bed4763555004f7658 /sysdeps
parent04067002e8c1be0c432bd608736750ca7459ec69 (diff)
downloadglibc-43b768284325b7e7d2ec3fc3dcac13a35c378c95.tar.gz
* sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
(PRINT_FPHEX_LONG_DOUBLE): Fix printing numbers where lower double is non-zero, but smaller than 2 * __DBL_MIN__. * stdio-common/tst-sprintf2.c: New test. * stdio-common/Makefile (tests): Add tst-sprintf2. * math/test-misc.c (main): Don't run last batch of tests with IBM long double format.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/printf_fphex.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
index 2a7b70fabf..b2ad25e31f 100644
--- a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
+++ b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c
@@ -1,5 +1,5 @@
/* Print floating point number in hexadecimal notation according to ISO C99.
- Copyright (C) 1997,1998,1999,2000,2001,2002,2004,2006
+ Copyright (C) 1997,1998,1999,2000,2001,2002,2004,2006,2007
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -35,21 +35,24 @@ do { \
\
lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3; \
hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1; \
- /* If the lower double is not a denomal or zero then set the hidden \
- 53rd bit. */ \
- if (eldbl.ieee.exponent2 > 0x001) \
- { \
- lo |= (1ULL << 52); \
- lo = lo << 7; /* pre-shift lo to match ieee854. */ \
- /* The lower double is normalized separately from the upper. We \
- may need to adjust the lower manitissa to reflect this. */ \
- ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2; \
- if (ediff > 53) \
- lo = lo >> (ediff-53); \
- } \
- \
- if ((eldbl.ieee.negative != eldbl.ieee.negative2) \
- && ((eldbl.ieee.exponent2 != 0) && (lo != 0L))) \
+ lo <<= 7; /* pre-shift lo to match ieee854. */ \
+ /* If the lower double is not a denomal or zero then set the hidden \
+ 53rd bit. */ \
+ if (eldbl.ieee.exponent2 != 0) \
+ lo |= (1ULL << (52 + 7)); \
+ else \
+ lo <<= 1; \
+ /* The lower double is normalized separately from the upper. We \
+ may need to adjust the lower manitissa to reflect this. */ \
+ ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2; \
+ if (ediff > 53 + 63) \
+ lo = 0; \
+ else if (ediff > 53) \
+ lo = lo >> (ediff - 53); \
+ else if (eldbl.ieee.exponent2 == 0 && ediff < 53) \
+ lo = lo << (53 - ediff); \
+ if (eldbl.ieee.negative != eldbl.ieee.negative2 \
+ && (eldbl.ieee.exponent2 != 0 || lo != 0L)) \
{ \
lo = (1ULL << 60) - lo; \
if (hi == 0L) \