Decimal
This class is used to compute real result from decimal calcul. By example, if we wan't to calcule 0.1 + 0.2, we'd like to have 0.3, but really, we obtain 0.30000000000004. So, this class allow to be precize computing with pows of 10 and treating only integers. Then, the result for 0.1 + 0.2 is 0.3.
Tests
To verify results, tests are presents. For that, it's possible to launch pytest to check calcul.
Operations
Plus
- Decimal.plus(0.1, 0.2) => 0.3
- Decimal.plus(0.1, 0.02) => 0.12
- Decimal.plus(0.200, 0.02) => 0.22
- Decimal.plus(1, 2) => 3
- Decimal.plus(1, 0.2) => 1.2
- Decimal.plus(0.000005, 1) => 1.000005
Minus
- TestDecimal.Operation(5, 3) => 2
- TestDecimal.Operation(3, 4) => -1
- TestDecimal.Operation(3.5, 4) => -0.5
- TestDecimal.Operation(3.5, 0.05) => 3.45
- TestDecimal.Operation(1, 3) => -2
- TestDecimal.Operation(0.1, 0.3) => -0.2
- TestDecimal.Operation(0.1, 0.2) => -0.1
- TestDecimal.Operation(0.3, 0.2) => 0.1
- TestDecimal.Operation(0.8, 9) => -8.2
Times
- Decimal.times(2, 1.5) => 3
- Decimal.times(3, 4) => 12
- Decimal.times(3.5, 4) => 14
- Decimal.times(3.5, 0.05) => 0.175
Divide
- Decimal.divide(6, 1.5) => 4
- Decimal.divide(3, 4) => 0.75
- Decimal.divide(3.5, 4) => 0.875
- Decimal.divide(3.5, 0.05) => 70
- Decimal.divide(1, 3) => 0.3333333333333333
- Decimal.divide(0.1, 0.3) => 0.3333333333333333
- Decimal.divide(0.1, 0.2) => 0.5
- Decimal.divide(0.8, 9) => 0.08888888888888889
Modulo
- Decimal.modulo(6, 1.5) => 0
- Decimal.modulo(3, 2) => 1
- Decimal.modulo(9.5, 2) => 1.5
Metadata
Release files for DecimalCalcul 2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| decimalcalcul-2.4.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| DecimalCalcul-2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / decimalcalcul-2.4.tar.gz
| Download URL | decimalcalcul-2.4.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1660e80a2529fcf8ee4876902e7176da132b7012e0d08e04142359e549202f5d
|
|
BLAKE2b-256 checksum How to use checksums |
763f019a43104042e89921db00d661bb43c31b1df51ade22d4c726291dd67c3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Release files / DecimalCalcul-2.4-py3-none-any.whl
| Download URL | DecimalCalcul-2.4-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49b8a84aeff85134c158d7a8b805deb8e65b5e9cadbc91e9f4a82ee71612dbb6
|
|
BLAKE2b-256 checksum How to use checksums |
1eb2acdc6d33f6f482c6c3892f26459b9eaf952aa4ea73eea2a66f9ee26be4dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|