diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-29 21:14:22 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-29 21:14:22 +0000 |
commit | a5bd524b0c4b5fd3d91bbbdd16baceafb07b11d3 (patch) | |
tree | 5016d5b89f3bdb36574cad26940fb18ba94a1653 /gcc/real.c | |
parent | a253fb3e9da4facc34310ab656d16f8582da0f79 (diff) | |
download | gcc-a5bd524b0c4b5fd3d91bbbdd16baceafb07b11d3.tar.gz |
PR c/21720
* real.c (real_from_string): Also set last bit if there is a
nonzero hex digit beyond GCC's internal precision after ".".
testsuite:
* gcc.dg/hex-round-1.c: Test more cases.
* gcc.dg/hex-round-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102567 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/real.c')
-rw-r--r-- | gcc/real.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/real.c b/gcc/real.c index 045a803a594..2d261852106 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -1815,6 +1815,10 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str) |= (unsigned long) d << (pos % HOST_BITS_PER_LONG); pos -= 4; } + else if (d) + /* Ensure correct rounding by setting last bit if there is + a subsequent nonzero digit. */ + r->sig[0] |= 1; str++; } } |