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
File details
Details for the file significant_figures-0.0.4.tar.gz
.
File metadata
- Download URL: significant_figures-0.0.4.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e6431587ab843d0d73e35d1b594f1823c1dd20143323155e4c359417f8eb7baf
|
|
MD5 |
cfe27b38e519f8d56ede321fcab14cca
|
|
BLAKE2b-256 |
e9e49c1e2873cc5a9344509f45a5210ce08d50da6dc5f1803af5fefc089732b9
|
File details
Details for the file significant_figures-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: significant_figures-0.0.4-py3-none-any.whl
- Upload date:
- Size: 2.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
c15bc96eb8d92e95f51ee3a5a8c2ca3892b904f72b0b9dd7ccf863e41423eac1
|
|
MD5 |
d1c2bc36a1a34e2b2f6a86d17645eb7f
|
|
BLAKE2b-256 |
150226e04688bb0fc76cba8f5dd2a243be00ac368673ff01ae527ca66d9c4ca5
|