Skip to main content

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

Metadata

Release files for pyfloat 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfloat 0.0.3
File Size Uploaded
pyfloat-0.0.3.tar.gz 17.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyfloat 0.0.3
File Interpreter ABI Platform
pyfloat-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 34.1 kB

Release files / pyfloat-0.0.3.tar.gz

Download URL pyfloat-0.0.3.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7c90d9e4a79057fbe62344134b458fe79ecf3b27dcdd325455c4aa206f7bdf34
BLAKE2b-256 checksum
How to use checksums
119cacdd61838c7a366c47bb74c57f5607f93616bfa314e486e3190f5643fdd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release files / pyfloat-0.0.3-py3-none-any.whl

Download URL pyfloat-0.0.3-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e9d93774739225903ef6ca93101e97387715c60e62b78d966ee60adf909dd1f
BLAKE2b-256 checksum
How to use checksums
91e2878df59e7c58d2066adadd4149e75a3e9e1e19f752d0ba61a3e08941742d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page