Skip to main content

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

Librería en PyPI

Ejemplo de uso

In[ ]:

from significant_figures import signif

signif(0.00047923, 2)

Out[ ]:

0.00048

Sobre el autor

GitHub

LinkedIn

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

significant_figures-0.0.4.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

significant_figures-0.0.4-py3-none-any.whl (2.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page