Library for rounding a number to a quantity of significant figures
Project description
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
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
Built Distribution
Hashes for significant_figures-0.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6431587ab843d0d73e35d1b594f1823c1dd20143323155e4c359417f8eb7baf |
|
MD5 | cfe27b38e519f8d56ede321fcab14cca |
|
BLAKE2b-256 | e9e49c1e2873cc5a9344509f45a5210ce08d50da6dc5f1803af5fefc089732b9 |
Hashes for significant_figures-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c15bc96eb8d92e95f51ee3a5a8c2ca3892b904f72b0b9dd7ccf863e41423eac1 |
|
MD5 | d1c2bc36a1a34e2b2f6a86d17645eb7f |
|
BLAKE2b-256 | 150226e04688bb0fc76cba8f5dd2a243be00ac368673ff01ae527ca66d9c4ca5 |