summaryrefslogtreecommitdiffstats
path: root/Modules/_decimal/libmpdec
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-05-31 14:00:21 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-05-31 14:00:21 (GMT)
commit5ddbcfc53eb579d27157b539c271534ccabac26a (patch)
tree1d3442c280facebe2b5d13cc900c11a8b4422f4d /Modules/_decimal/libmpdec
parentc73e8c2830b8ab6983d8abd156de4ac8e22c3edd (diff)
downloadcpython-5ddbcfc53eb579d27157b539c271534ccabac26a.zip
cpython-5ddbcfc53eb579d27157b539c271534ccabac26a.tar.gz
cpython-5ddbcfc53eb579d27157b539c271534ccabac26a.tar.bz2
Pad the result with zeros just before the final rounding.
Diffstat (limited to 'Modules/_decimal/libmpdec')
-rw-r--r--Modules/_decimal/libmpdec/mpdecimal.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c
index 3f43db4..17fcf25 100644
--- a/Modules/_decimal/libmpdec/mpdecimal.c
+++ b/Modules/_decimal/libmpdec/mpdecimal.c
@@ -3903,7 +3903,6 @@ _mpd_qexp_check_one(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
/* abs(a) <= 9 * 10**(-prec-1) */
if (_mpd_cmp(&aa, &lim) <= 0) {
_settriple(result, 0, 1, 0);
- _mpd_zeropad(result, ctx, status);
*status |= MPD_Rounded|MPD_Inexact;
return 1;
}
@@ -4074,8 +4073,6 @@ _mpd_qexp(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
}
#endif
- _mpd_zeropad(result, ctx, status);
-
mpd_del(&tmp);
mpd_del(&sum);
*status |= (workctx.status&MPD_Errors);
@@ -4148,6 +4145,7 @@ mpd_qexp(mpd_t *result, const mpd_t *a, const mpd_context_t *ctx,
if (mpd_isspecial(result) || mpd_iszerocoeff(result) ||
mpd_qcmp(&t1, &t2, status) == 0) {
workctx.clamp = ctx->clamp;
+ _mpd_zeropad(result, ctx, status);
mpd_check_underflow(result, &workctx, status);
mpd_qfinalize(result, &workctx, status);
break;