Función signif en Pyhton
Esta función te permite expresar cualquier número real con una determinada cantidad de cifras significativas de forma sencilla. Está inspirada en la función signif de R que realiza la misma tarea y de la cual hereda su nombre.
La función signif(x, n) redondea el valor de su primer argumento x, al número de cifras significativas especificado en su segundo argumento n. Concretamente realiza la operación round(x, n-int(math.floor(math.log10(abs(x))))-1).
El argumento x debe ser de tipo int o float mientras que el argumento n debe ser de tipo int.
Instalación
pip install significant-figures==0.0.4
Ejemplo de uso
In[ ]:
from significant_figures import signif
signif(0.00047923, 2)
Out[ ]:
0.00048
Sobre el autor
Metadata
Release files for significant-figures 0.0.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 | |
|---|---|---|---|
| significant_figures-0.0.4.tar.gz | 2.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| significant_figures-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.2 kB
Release files / significant_figures-0.0.4.tar.gz
| Download URL | significant_figures-0.0.4.tar.gz |
|---|---|
| Size | 2.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e6431587ab843d0d73e35d1b594f1823c1dd20143323155e4c359417f8eb7baf
|
|
BLAKE2b-256 checksum How to use checksums |
e9e49c1e2873cc5a9344509f45a5210ce08d50da6dc5f1803af5fefc089732b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.5
|
Release files / significant_figures-0.0.4-py3-none-any.whl
| Download URL | significant_figures-0.0.4-py3-none-any.whl |
|---|---|
| Size | 2.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c15bc96eb8d92e95f51ee3a5a8c2ca3892b904f72b0b9dd7ccf863e41423eac1
|
|
BLAKE2b-256 checksum How to use checksums |
150226e04688bb0fc76cba8f5dd2a243be00ac368673ff01ae527ca66d9c4ca5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.5
|