summaryrefslogtreecommitdiffstats
path: root/Modules/_decimal/_decimal.c
Commit message (Collapse)AuthorAgeFilesLines
* Issue #15882: Change _decimal to accept any coefficient tuple whenStefan Krah2012-09-101-0/+7
| | | | | | constructing infinities. This is done for backwards compatibility with decimal.py: Infinity coefficients are undefined in _decimal (in accordance with the specification).
* Issue #15544: Fix Decimal.__float__ to work with payload-carrying NaNs.Mark Dickinson2012-08-241-1/+17
|
* mpd_qpowmod(): calculate result with zero-exponent for compatibility withStefan Krah2012-08-231-8/+0
| | | | decimal.py. The hack to remove the ideal exponent is no longer required.
* In the 32-bit build, dec_hash() raised InvalidOperation if the operandStefan Krah2012-08-221-4/+12
| | | | | | had a coefficient with MAX_PREC=425000000 digits and a negative exponent. Increasing the context limits above the official values fixes the issue and is safe (in this case!).
* Add unused parameter to a couple of METH_NOARGS functions. The previousStefan Krah2012-07-281-8/+8
| | | | | form is used in many places in the source tree, but was found to be incorrect in a recent tracker discussion.
* Proactive reliability fix for broken FPUs: The base conversion functionsStefan Krah2012-06-301-18/+20
| | | | | | | | | | use log10() to calculate the size of the output array. The current code has been tested on x86/amd64 (and to a lesser extent on qemu-mips qemu-sparc) and produces sufficiently large values for all inputs tested so far (coefficient sizes of 10**18 - 1 are hard to test exhaustively). The new code does not rely on the correctness of log10() and resizes the output arrays if the allocated space is insufficient.
* Speed up _decimal by another 10-15% by caching the thread local contextStefan Krah2012-06-241-21/+58
| | | | | that was last accessed. In the pi benchmark (64-bit platform, prec=9), _decimal is now only 1.5x slower than float.
* 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
|
* 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
|
* 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-051-2/+2
| | | | | 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
|
* 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.
* 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-211-2/+2
|
* Issue #7652: Integrate the decimal floating point libmpdec library to speedStefan Krah2012-03-211-0/+5512
up the decimal module. Performance gains of the new C implementation are between 12x and 80x, depending on the application.