diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-07-20 22:17:23 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-07-20 22:17:23 +0000 |
commit | 7fd8ef31edaf4532445ac24841b4a3e6f3fac54b (patch) | |
tree | a28973bdb76a7f9b6c2926eba5360902c5f5cf07 | |
parent | 1e34b5e7760a6c6095a4c34e3108416bab3558de (diff) | |
download | mpfr-7fd8ef31edaf4532445ac24841b4a3e6f3fac54b.tar.gz |
[src/get_d128.c] For the special values, avoid double to _Decimal128
conversions, as for such conversions, GCC generates from 2 to 3 MB in
the shared library when the decimal encoding is BID, and there will be
no fix in GCC:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96173
We now use computations on _Decimal128 constants directly, which could
thus be done at compile time. We expect no problems similar to double,
as the _Decimal128 implementation should follow the IEEE 754 rules.
This commit should avoid a large part of the problem reported at:
https://gforge.inria.fr/tracker/?func=detail&atid=619&aid=21849&group_id=136
(merged changesets r14087-14088 from the trunk)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/branches/4.1@14094 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | src/get_d128.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/get_d128.c b/src/get_d128.c index 69b1d2064..c849f6c29 100644 --- a/src/get_d128.c +++ b/src/get_d128.c @@ -40,22 +40,21 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., static _Decimal128 get_decimal128_nan (void) { - return (_Decimal128) MPFR_DBL_NAN; + return 0.0dl / 0.0dl; } /* construct the decimal128 Inf with given sign */ static _Decimal128 get_decimal128_inf (int negative) { - return (_Decimal128) (negative ? MPFR_DBL_INFM : MPFR_DBL_INFP); + return negative ? - 1.0dl / 0.0dl : 1.0dl / 0.0dl; } /* construct the decimal128 zero with given sign */ static _Decimal128 get_decimal128_zero (int negative) { - _Decimal128 zero = 0; - return (_Decimal128) (negative ? -zero : zero); + return negative ? - 0.0dl : 0.0dl; } /* construct the decimal128 smallest non-zero with given sign: |