[Python-checkins] cpython: Use workctx instead of ctx for cosmetic reasons. Also zero-pad the result

stefan.krah python-checkins at python.org
Thu May 31 20:50:44 CEST 2012


http://hg.python.org/cpython/rev/fb79cf1d21c9
changeset:   77269:fb79cf1d21c9
user:        Stefan Krah <skrah at bytereef.org>
date:        Thu May 31 20:49:24 2012 +0200
summary:
  Use workctx instead of ctx for cosmetic reasons. Also zero-pad the result
in the simple path (not correctly rounded but faster).

files:
  Modules/_decimal/libmpdec/mpdecimal.c |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c
--- a/Modules/_decimal/libmpdec/mpdecimal.c
+++ b/Modules/_decimal/libmpdec/mpdecimal.c
@@ -4168,7 +4168,7 @@
             if (mpd_isspecial(result) || mpd_iszerocoeff(result) ||
                 mpd_qcmp(&t1, &t2, status) == 0) {
                 workctx.clamp = ctx->clamp;
-                _mpd_zeropad(result, ctx, status);
+                _mpd_zeropad(result, &workctx, status);
                 mpd_check_underflow(result, &workctx, status);
                 mpd_qfinalize(result, &workctx, status);
                 break;
@@ -4182,6 +4182,7 @@
     }
     else {
         _mpd_qexp(result, a, &workctx, status);
+        _mpd_zeropad(result, &workctx, status);
         mpd_check_underflow(result, &workctx, status);
         mpd_qfinalize(result, &workctx, status);
     }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list