Commit Graph

116 Commits

Author SHA1 Message Date
Stefan Krah dc36efa368 1) Fix comment.
2) Assert that the source operand is not special. Prevent resulting assert
   failure (harmless) by initializing flags before calling mpd_qshiftr_inplace.

3) Save a couple of instructions (mpd_zerocoeff already sets digits and len).
   Reorder initialization to match the order in the mpd_t struct.
2012-04-07 15:57:59 +02:00
Stefan Krah 4771cca817 Whitespace. 2012-04-05 16:15:25 +02:00
Stefan Krah 871b96bd5a Reduce array size. 2012-04-05 16:07:22 +02:00
Stefan Krah a6169484c2 Formatting. 2012-04-05 15:48:59 +02:00
Stefan Krah ff3eca0cc3 Allow printing a leading '-' and the maximum number of exponent digits
rather than raising RuntimeError (allocated space is sufficient for the
additional character).
2012-04-05 15:46:19 +02:00
Stefan Krah 0774e9b9f5 Raise InvalidOperation if exponents of zeros are clamped during exact
conversion in the Decimal constructor. Exact here refers to the
representation and not to the value (clamping does not change the value).
2012-04-05 15:21:58 +02:00
Stefan Krah 91c0274bc4 Improve comments. 2012-04-02 20:51:08 +02:00
Stefan Krah 5100171d81 Clear the context flags if a context is initialized from the DefaultContext. 2012-04-02 15:02:21 +02:00
Stefan Krah 41e031004b Fix Overflow exception in the bignum factorial benchmark that is due to
the recent change of the default value for context.Emax.
2012-04-01 23:25:34 +02:00
Stefan Krah 0e41981cd5 Use abort() rather than exit() to appease tools like rpmlint. abort() is used
in libmpdec to prevent undefined behavior if an invalid context is used. This
cannot occur for the _decimal module since user input for the context is
validated.
2012-03-30 14:12:20 +02:00
Stefan Krah fe17b2bc77 Raise MemoryError instead of InvalidOperation/MallocError for compatibility
with decimal.py. The standard specifies InsufficientStorage (MallocError) as
a sub-condition of InvalidOperation. This allows a calculation to continue
with NaN results when allocation fails.
2012-03-25 18:59:21 +02:00
Stefan Krah c64150bcac Fix formatting after removing tabs. 2012-03-23 16:34:41 +01:00
Stefan Krah cd9e1d0205 Whitespace. 2012-03-23 16:22:05 +01:00
Stefan Krah b6405efd1b Use the same exception hierarchy as decimal.py. FloatOperation now also
inherits from TypeError. Cleanup in module initialization to make repeated
import failures robust.
2012-03-23 14:46:48 +01:00
Stefan Krah 7cc5521d40 Whitespace. 2012-03-21 20:21:20 +01:00
Stefan Krah 1919b7e72b Issue #7652: Integrate the decimal floating point libmpdec library to speed
up the decimal module. Performance gains of the new C implementation are
between 12x and 80x, depending on the application.
2012-03-21 18:25:23 +01:00