cpython/Modules/_decimal
Serhiy Storchaka 5217328f93
gh-121798: Add class method Decimal.from_number() (GH-121801)
It is an alternate constructor which only accepts a single numeric argument.
Unlike to Decimal.from_float() it accepts also Decimal.
Unlike to the standard constructor, it does not accept strings and tuples.
2024-10-14 08:24:01 +00:00
..
libmpdec gh-108562: Fix compiler warnings for libmpdec (#114751) 2024-03-03 08:25:39 +01:00
tests gh-109649: Use os.process_cpu_count() (#110165) 2023-10-01 03:14:57 +02:00
windows gh-115119: Switch Windows build to mpdecimal external (GH-115182) 2024-03-18 12:07:25 -05:00
_decimal.c gh-121798: Add class method Decimal.from_number() (GH-121801) 2024-10-14 08:24:01 +00:00
docstrings.h gh-121798: Add class method Decimal.from_number() (GH-121801) 2024-10-14 08:24:01 +00:00
README.txt Remove trailing whitespace. 2013-01-16 15:16:10 +01:00


About
=====

_decimal.c is a wrapper for the libmpdec library. libmpdec is a fast C
library for correctly-rounded arbitrary precision decimal floating point
arithmetic. It is a complete implementation of Mike Cowlishaw/IBM's
General Decimal Arithmetic Specification.


Build process for the module
============================

As usual, the build process for _decimal.so is driven by setup.py in the top
level directory. setup.py autodetects the following build configurations:

   1) x64         - 64-bit Python, x86_64 processor (AMD, Intel)

   2) uint128     - 64-bit Python, compiler provides __uint128_t (gcc)

   3) ansi64      - 64-bit Python, ANSI C

   4) ppro        - 32-bit Python, x86 CPU, PentiumPro or later

   5) ansi32      - 32-bit Python, ANSI C

   6) ansi-legacy - 32-bit Python, compiler without uint64_t

   7) universal   - Mac OS only (multi-arch)


It is possible to override autodetection by exporting:

   PYTHON_DECIMAL_WITH_MACHINE=value, where value is one of the above options.


NOTE
====

decimal.so is not built from a static libmpdec.a since doing so led to
failures on AIX (user report) and Windows (mixing static and dynamic CRTs
causes locale problems and more).