Commit Graph

109 Commits

Author SHA1 Message Date
Stefan Krah 0455c3fd28 Whitespace. 2014-01-04 13:03:48 +01:00
Stefan Krah 1f1ec12db9 Issue #19986: Avoid an incorrect warning of older gcc versions. 2013-12-15 20:45:08 +01:00
Stefan Krah 01e5f800b4 Fix C++ header usage. This __STDC_LIMIT_MACROS scheme can still be subverted
by including stdint.h before mpdecimal.h.  In that case the only option left
is to compile with -D_STDC_LIMIT_MACROS.
2013-12-14 12:58:09 +01:00
Stefan Krah da12adac10 Do not discard const qualifier without a reason. 2013-12-12 18:51:51 +01:00
Stefan Krah 37d4e0be3d Fix two typos. 2013-12-08 20:08:32 +01:00
Stefan Krah 42e3b607cb Missed one copyright. 2013-12-08 20:00:56 +01:00
Stefan Krah ecff6554d3 Update copyright. The four year increment is intentional (to save work). 2013-12-08 19:54:05 +01:00
Stefan Krah 4b7f7acf30 Make a couple of parameters constant. 2013-12-03 14:33:46 +01:00
Stefan Krah 45059eb1d0 1) Prepare libmpdec for the 2.4.0 release. None of the following changes affects
_decimal:

      o Make all "mpd_t to C integer" conversion functions available in both the
        64-bit and the 32-bit versions.

      o Make all mixed mpd_t/C integer arithmetic functions available in the
        32-bit version.

      o Better handling of __STDC_LIMIT_MACROS for C++ users.

      o Add struct tags (at the request of C++ users).

2) Check for libmpdec.so.2 if --with-system-libmpdec is used.
2013-11-24 19:44:57 +01:00
Stefan Krah 2fdf4e7b9b Move PyErr_NoMemory() closer to the failure. 2013-11-08 18:05:02 +01:00
Stefan Krah a0fd1f5a18 Change style to match the surrounding code (no early returns). 2013-11-08 17:48:58 +01:00
Victor Stinner ac470854b8 Issue #19437: Fix dec_format() of the _decimal module, handle dec_strdup()
failure (memory allocation failure): raise a MemoryError exception
2013-10-29 20:33:14 +01:00
Victor Stinner a992e11fe3 Issue #19437: Fix convert_op_cmp() of decimal.Decimal rich comparator, handle
PyObject_IsInstance() failure
2013-10-29 19:26:11 +01:00
Stefan Krah 04754b0fd4 Support multiarch build in tests. 2013-05-29 20:58:19 +02:00
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
Ezio Melotti 3f5db3940f Fix a few typos and a double semicolon. Patch by Eitan Adler. 2013-01-27 06:20:14 +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 752bfb71d8 Remove trailing whitespace. 2013-01-16 15:16:10 +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 e3dff55a5e Issue #16753: Define __GNUC_STDC_INLINE__ to an integer (same as gcc). 2012-12-23 15:42:21 +01:00
Stefan Krah f03eee12b4 Issue #16745: The gcc visibility pragma is buggy on OpenIndiana and NetBSD. 2012-12-22 23:05:51 +01:00
Stefan Krah 66a6f3fa81 Fix Visual Studio build. 2012-12-22 14:46:44 +01:00
Stefan Krah fdf1a34ba1 Issue #16745: Hide symbols in _decimal.so. 2012-12-22 14:18:35 +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 a0346e56ac Support gcc's -ansi flag: use "__asm__" instead of "asm". 2012-09-30 17:31:04 +02:00
Stefan Krah e59aa8c94d Revert 29506c7db353 (build output should be accurate). 2012-09-30 17:20:47 +02:00
Christian Heimes 5c9a5895d4 merge 2012-09-30 15:51:39 +02:00
Christian Heimes 72c9946718 Change libmpdec to use ANSI code in strict ansi mode as inline asm isn't supported in ANSI C 2012-09-30 15:49:56 +02:00
Stefan Krah 9a3f05e60f Make it clear that the pi function is modified for benchmarking purposes. 2012-09-30 09:24:41 +02:00
Stefan Krah 6b6a1df996 Restore the benchmark order to avoid waiting for decimal.py if just the
prec=9 test is used.
2012-09-25 17:07:55 +02:00
Brett Cannon 6cf50c5b1d Fix whitespace. 2012-09-25 10:26:15 -04:00
Brett Cannon 63092fe0ea Fix whitespace. 2012-09-25 10:25:41 -04:00
Brett Cannon d266c4451f Make the decimal bench file run under Python 2.7. 2012-09-25 10:23:47 -04:00
Stefan Krah 7e6523fbd7 Use C-style comments. 2012-09-23 15:46:09 +02:00
Stefan Krah 76e12179c5 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 17183a2972 Use zero bottom margin. 2012-08-22 19:28:12 +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 2fd502f6a1 1) Use _mpd_basedivmod() regardless of the length of the dividend. This is
required for a corner case in dec_hash() in the following commit and also
   usually faster. dec_hash() needs some extra precision above MPD_MAX_PREC,
   and _mpd_base_ndivmod() is not audited for that.

2) Use _mpd_basemul() if the length of the smaller operand is less than
   or equal to 256. While this is technically an optimization, it is
   required for *testing* corner cases in dec_hash() in reasonable time.
2012-08-22 18:54:37 +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 26a1c7a905 Fix Visual Studio warning. 2012-07-20 12:34:18 +02:00
Stefan Krah e574402bd6 Issue #7652: Clean up _mpd_qinvroot() and mark it LIBMPDEC_ONLY. Use the
algorithm from decimal.py for mpd_qsqrt().
2012-07-12 21:17:59 +02:00