summaryrefslogtreecommitdiffstats
path: root/Modules/_decimal
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove redundant finalization of the result.Stefan Krah2012-04-181-2/+0
|
* Fix comments and whitespace.Stefan Krah2012-04-181-8/+8
|
* Support mythical ones' complement machines.Stefan Krah2012-04-181-1/+1
|
* The previous code is correct, but hard to verify: The libmpdec documentationStefan Krah2012-04-181-1/+2
| | | | | | | | | | | rightfully states that an mpd_t with a coefficient flagged as MPD_CONST_DATA must not be in the position of the result operand. In this particular case several assumptions guarantee that a resize will never occur in all possible code paths, which was the reason for using MPD_CONST_DATA and saving an instruction by omitting the initialization of tmp.alloc. For readability, tmp is now flagged as MPD_STATIC_DATA and tmp.alloc is initialized.
* 1) Remove claim of an input invariant that is only true for static mpd_t.Stefan Krah2012-04-102-4/+2
| | | | | | | | | | | | | | | | | | Resizing is used _inside_ libmpdec functions, and it is permitted to change x->alloc several times while setting x->len at the end of the function. Therefore, for dynamic mpd_t x->alloc can _temporarily_ drop below x->len. Of course the final result always has x->len <= x->alloc. For static mpd_t this cannot happen, since resizing to a smaller coefficient is a no-op. 2) Remove micro optimization in mpd_switch_to_dyn(): Previously only the valid initialized part of the existing coefficient up to x->len was copied to the new dynamic memory area. Now copying does the same as realloc() and the entire old memory area is copied. The rationale for this change is that it is no longer needed to memorize the explanation given in 1).
* Fix stale comment.Stefan Krah2012-04-101-3/+4
|
* Issue #14478: Cache the hash of a Decimal in the C version.Stefan Krah2012-04-101-1/+14
|
* Issue #14520: Add __sizeof__() method to the Decimal object.Stefan Krah2012-04-091-0/+14
|
* Resize the coefficient to MPD_MINALLOC also if the requested size is belowStefan Krah2012-04-091-11/+15
| | | | MPD_MINALLOC. Previously the resize was skipped as a micro optimization.
* Speed up _decimal by 30-40% for numerical workloads by improving the cacheStefan Krah2012-04-091-16/+18
| | | | locality for regularly sized coefficients.
* Use the MPD() accessor macro.Stefan Krah2012-04-091-2/+2
|
* 1) Fix comment.Stefan Krah2012-04-071-15/+12
| | | | | | | | 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.
* Whitespace.Stefan Krah2012-04-051-1/+1
|
* Reduce array size.Stefan Krah2012-04-051-1/+1
|
* Formatting.Stefan Krah2012-04-051-2/+2
|
* Allow printing a leading '-' and the maximum number of exponent digitsStefan Krah2012-04-051-2/+2
| | | | | rather than raising RuntimeError (allocated space is sufficient for the additional character).
* Raise InvalidOperation if exponents of zeros are clamped during exactStefan Krah2012-04-052-2/+3
| | | | | conversion in the Decimal constructor. Exact here refers to the representation and not to the value (clamping does not change the value).
* Improve comments.Stefan Krah2012-04-021-5/+5
|
* Clear the context flags if a context is initialized from the DefaultContext.Stefan Krah2012-04-021-0/+8
|
* Fix Overflow exception in the bignum factorial benchmark that is due toStefan Krah2012-04-011-1/+4
| | | | the recent change of the default value for context.Emax.
* Use abort() rather than exit() to appease tools like rpmlint. abort() is usedStefan Krah2012-03-301-1/+1
| | | | | | 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.
* Raise MemoryError instead of InvalidOperation/MallocError for compatibilityStefan Krah2012-03-251-1/+8
| | | | | | 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.
* Fix formatting after removing tabs.Stefan Krah2012-03-232-4/+8
|
* Whitespace.Stefan Krah2012-03-232-102/+102
|
* Use the same exception hierarchy as decimal.py. FloatOperation now alsoStefan Krah2012-03-231-20/+65
| | | | | inherits from TypeError. Cleanup in module initialization to make repeated import failures robust.
* Whitespace.Stefan Krah2012-03-216-168/+168
|
* Issue #7652: Integrate the decimal floating point libmpdec library to speedStefan Krah2012-03-2154-0/+26284
up the decimal module. Performance gains of the new C implementation are between 12x and 80x, depending on the application.