diff options
author | janis <janis@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-17 17:07:24 +0000 |
---|---|---|
committer | janis <janis@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-09-17 17:07:24 +0000 |
commit | 3c9085936228ac479154971fc23f5fbf2e85af0c (patch) | |
tree | 76332f90632195d93b999cee84b8426bd071c7d0 /gcc/config/dfp-bit.c | |
parent | c3ab1ea8f83f0dd64d0ad48aaad4b40ee7a4720f (diff) | |
download | gcc-3c9085936228ac479154971fc23f5fbf2e85af0c.tar.gz |
gcc/
PR c/41049
* real.c decimal_from_integer, decimal_integer_string): New.
(real_from_integer): Use them as special case for decimal float.
* config/dfp-bit.c (_si_to_sd, _usi_to_sd): Use default rounding.
(_di_to_sd, _di_to_dd, _di_to_td, _udi_to_sd, _udi_to_dd, _udi_to_td):
Do not append zero after the decimal point in string to convert.
gcc/testsuite/
PR c/41049
* dfp/pr41049.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151806 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/dfp-bit.c')
-rw-r--r-- | gcc/config/dfp-bit.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/config/dfp-bit.c b/gcc/config/dfp-bit.c index d315d5b56f0..19f2fdae67d 100644 --- a/gcc/config/dfp-bit.c +++ b/gcc/config/dfp-bit.c @@ -568,7 +568,6 @@ INT_TO_DFP (INT_TYPE i) decContext context; decContextDefault (&context, DEC_INIT_DECIMAL128); - context.round = DEC_ROUND_DOWN; f64 = *DEC_FLOAT_FROM_INT (&f64, i); u32.f = *decSingleFromWider (&u32.f, &f64, &context); if (DFP_EXCEPTIONS_ENABLED && context.status != 0) @@ -593,7 +592,7 @@ INT_TO_DFP (INT_TYPE i) DFP_INIT_ROUNDMODE (context.round); /* Use a C library function to get a floating point string. */ - sprintf (buf, INT_FMT ".0", CAST_FOR_FMT(i)); + sprintf (buf, INT_FMT ".", CAST_FOR_FMT(i)); /* Convert from the floating point string to a decimal* type. */ FROM_STRING (&s, buf, &context); IEEE_TO_HOST (s, &f); |