FDecimal
Decimal compatability with float
Free software: BSD license
Features
Implicit float-to-Decimal coercion for arithmetic operations.
Instead of this:
>>> from decimal import Decimal >>> Decimal(12.0) * 0.5 TypeError: unsupported operand type(s) for *: 'Decimal' and 'float'
Use FDecimal:
>>> from fdecimal import FDecimal
>>> FDecimal(12.0) * 0.5
Decimal('6.0')
As you can see it only solves part of the problem - the result still can’t be added with a float value without explicit type coercion, but it solves some problems where (1) its not clear what type the other value will be, (2) you don’t want to add code explicitly handling that coercion, and (3) an arithmetic surprises due to working with different numeric types are acceptable.
TODO
Missing operations, including mod, floor div
Python 3 support
Allow cdecimal swap-in
Done:
Return FDecimal objects rather than Decimal objects
History
0.2.0 (2016-01-14)
Add support for returning FDecimal objects from operations
0.1.0 (2016-01-14)
First release on PyPI.
Metadata
Release files for fdecimal 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fdecimal-0.2.0.tar.gz | 6.7 kB | Without provenance | Details for fdecimal-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fdecimal-0.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for fdecimal-0.2.0-py2.py3-none-any.whl |
Total release size: 12.4 kB
Release files / fdecimal-0.2.0.tar.gz
| Download URL | fdecimal-0.2.0.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26a49ba88a96d341073dd136d5fc8136f2693f88b5dc4b5b2e56c9d87c7cecca
|
|
BLAKE2b-256 checksum How to use checksums |
ae1d1a1261e4074e34c974dd4e15ec3438a9c5af2987c7f71145dd6764ece13d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / fdecimal-0.2.0-py2.py3-none-any.whl
| Download URL | fdecimal-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a94c8e7fbdbcde63f0f4108601f43720e445ea89eb07fc3da6b514bf1c7e7ee6
|
|
BLAKE2b-256 checksum How to use checksums |
72ab79f3af61304197b082b3184ce1332dd6dbfd0c6fa5a538ffa19f18250a08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for fdecimal 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.