Stefan Krah
891ca9e06a
Backport bff16086f03b and bcaaaa00425b.
2013-05-29 19:14:17 +02:00
Stefan Krah
6edda14b29
Issue #17768 : Support newline fill character in decimal.py and NUL fill
...
character in _decimal.c.
2013-05-29 15:45:38 +02:00
Stefan Krah
eb8c451bd2
Since the return type of format() is not a Decimal, raise ValueError instead of
...
InvalidOperation if the format specification (width, prec) exceeds the internal
limits of libmpdec.
2013-01-24 15:22:33 +01:00
Stefan Krah
59a4a93f43
Issue #16422 : Use strings for rounding mode constants for better readability
...
and pickling compatibility.
2013-01-16 12:58:59 +01:00
Stefan Krah
fb7f580e81
Issue #16745 : Hide a couple of symbols by making them local.
2012-12-21 23:11:05 +01:00
Stefan Krah
9a4ff437d1
Issue #15783 : Support None default values in the Context() constructor.
2012-12-16 21:10:35 +01:00
Stefan Krah
040e311826
Issue #15783 : Except for the number methods, the C version of decimal now
...
supports all None default values present in decimal.py. These values were
largely undocumented.
2012-12-15 22:33:33 +01:00
Stefan Krah
6e467049c6
Accept Unicode legacy strings in the Decimal constructor.
2012-11-10 23:09:04 +01:00
Stefan Krah
0f82b76b57
Issue #16431 : Finally, consider all permutations.
2012-11-08 11:17:29 +01:00
Stefan Krah
ed16eff57e
Issue #16431 : Also fix the opposite direction.
2012-11-07 23:47:19 +01:00
Stefan Krah
f4abc7b8a0
Issue #16431 : Use the type information when constructing a Decimal subtype
...
from a Decimal argument.
2012-11-07 23:12:25 +01:00
Stefan Krah
dbcf103be0
Issue #15882 : Change _decimal to accept any coefficient tuple when
...
constructing infinities. This is done for backwards compatibility
with decimal.py: Infinity coefficients are undefined in _decimal
(in accordance with the specification).
2012-09-10 19:34:58 +02:00
Mark Dickinson
fc33d4ce0a
Issue #15544 : Fix Decimal.__float__ to work with payload-carrying NaNs.
2012-08-24 18:53:10 +01:00
Stefan Krah
f21587e3a8
mpd_qpowmod(): calculate result with zero-exponent for compatibility with
...
decimal.py. The hack to remove the ideal exponent is no longer required.
2012-08-23 15:05:29 +02:00
Stefan Krah
ad5b43995e
In the 32-bit build, dec_hash() raised InvalidOperation if the operand
...
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!).
2012-08-22 19:11:50 +02:00
Stefan Krah
b9e36b97f2
Add unused parameter to a couple of METH_NOARGS functions. The previous
...
form is used in many places in the source tree, but was found to be incorrect
in a recent tracker discussion.
2012-07-28 13:53:47 +02:00
Stefan Krah
c35a8e5c98
Proactive reliability fix for broken FPUs: The base conversion functions
...
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.
2012-06-30 18:05:33 +02:00
Stefan Krah
78f075636c
Speed up _decimal by another 10-15% by caching the thread local context
...
that was last accessed. In the pi benchmark (64-bit platform, prec=9),
_decimal is now only 1.5x slower than float.
2012-06-24 12:20:03 +02:00
Stefan Krah
cc74b6ab14
Issue #14478 : Cache the hash of a Decimal in the C version.
2012-04-10 16:27:58 +02:00
Stefan Krah
e37f8b29fc
Issue #14520 : Add __sizeof__() method to the Decimal object.
2012-04-09 21:27:20 +02:00
Stefan Krah
dd159ce606
Speed up _decimal by 30-40% for numerical workloads by improving the cache
...
locality for regularly sized coefficients.
2012-04-09 20:24:57 +02:00
Stefan Krah
94ef3e4c1d
Use the MPD() accessor macro.
2012-04-09 19:20:46 +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
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
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