Python Library for doing math operations with floats without lossing precission
Project description
PyFloat Lib
Python Library for doing math operations with floats without lossing precission
How to use
>> from pyfloat import PyFloat
>> PyFloat(2.1234e-12)
'0.0000000000021234'
>> PyFloat(-2.1234e+12)
'-2123400000000'
>> PyFloat(0.1452)
'0.1452'
>> PyFloat(PyFloat(152.455))
'152.455'
>> a = PyFloat("123451.1234551230000000004444445551122000000011")
>> b = PyFloat(-8123994.000002234100000001323400000001232112221)
>> a + b
'-8000542.8765471111000000008789554448890321122199'
>> a - b
'8247445.1234573571000000017678445551134321122221'
>> a * b
'-1002916186242.9543234169148643344158458369442274183843912848765430855693663896461975553234431'
>> a == b
'False'
>> a != b
'True'
>> a > b
'True'
>>> PyFloat(0.00239419391).round(10)
'0.0023941939'
>>> PyFloat(0.00239419391).round(7)
'0.0023942'
>>> PyFloat(-0.00239419391).round(7)
'-0.0023942'
>>> PyFloat(0.00239419391).round(4)
'0.0024'
>>> PyFloat(-1234.5678).abs()
'1234.5678'
>>> PyFloat(0.0000089778).truncate(8)
'0.00000897'
>>> PyFloat(-0.0000089778).truncate(8)
-0.00000897
Test
python pytfloat_test.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyfloat-0.0.3.tar.gz
(17.4 kB
view details)
Built Distribution
pyfloat-0.0.3-py3-none-any.whl
(16.7 kB
view details)
File details
Details for the file pyfloat-0.0.3.tar.gz
.
File metadata
- Download URL: pyfloat-0.0.3.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c90d9e4a79057fbe62344134b458fe79ecf3b27dcdd325455c4aa206f7bdf34 |
|
MD5 | 32920d1f7e2f1ea4cda69cf52a5943b1 |
|
BLAKE2b-256 | 119cacdd61838c7a366c47bb74c57f5607f93616bfa314e486e3190f5643fdd6 |
File details
Details for the file pyfloat-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: pyfloat-0.0.3-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e9d93774739225903ef6ca93101e97387715c60e62b78d966ee60adf909dd1f |
|
MD5 | 04272259c0607fc64b07fdcf10e0eba6 |
|
BLAKE2b-256 | 91e2878df59e7c58d2066adadd4149e75a3e9e1e19f752d0ba61a3e08941742d |