pysigfig
A package for creating and manipulating floating point numbers accounting for significant figures
Quickstart
import math
import pysigfig as pysf
# a number with 4 singificant digits
x = pysf.Float("1.234")
# a number with 3 significant digits
y = pysf.Float("31.1")
z1 = x + y
z2 = x * y
# z1 should have tenths digit as the least significant
print(z1)
# z2 should have 3 significant digits
print(z2)
area = pysf.Const(math.pi) * pysf.Float("2.0")**2
# area should have 2 significant digits
print(area)
References
For a simple overview of arithmetic with significant figures, see the Wikipedia Page.
Methods of Entry
# Enter a floating point number and specify the number of significant digits
pysf.Float(1.2345, 2)
pysf.Float(1.2, 8)
# Enter the string representation
pysf.Float("1.23") # 3 sig figs
pysf.Float("1.230000") # 7 sig figs
pysf.Float("0.0045") # 2 sig figs
pysf.Float("100000") # 6 sig figs
pysf.Float("1.0E+06") # 2 sig figs
# Enter a constant
pysf.Const(2)
pysf.Const(math.pi)
Limitations
pysigfig cannot accept a string like "100000" and assign only one significant digit to it. However, this can be entered in scientific notation or as a float.
# Enter 100000 with 1 significant figure
pysf.Float("1E+05")
pysf.Float(100000, 1)
Release files for pysigfig 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pysigfig-0.0.2.tar.gz | 8.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pysigfig-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.0 kB
Release files / pysigfig-0.0.2.tar.gz
| Download URL | pysigfig-0.0.2.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70c8eabf919f214349dd3d366bbc54741ecdcca7f032b1168711cb53fddf4faf
|
|
BLAKE2b-256 checksum How to use checksums |
a75d7fc7b2f3d095e0aa6518f6e4c379aaaec3f8c5c80208bc7491cfad33f4fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|
Release files / pysigfig-0.0.2-py3-none-any.whl
| Download URL | pysigfig-0.0.2-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6129a64a1623afd286c07f16eca2a7056168fbe31aab5f0a85c887d31b7050f
|
|
BLAKE2b-256 checksum How to use checksums |
c71221898cc50558602919c6f5ec09dafb8615130db2f5be725c2cd6a584d5f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1
|