8000 Precision based on number of digits · Issue #5 · cfobel/si-prefix · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Precision based on number of digits #5 8000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
robertvandeneynde opened this issue May 21, 2018 · 1 comment
Open

Precision based on number of digits #5

robertvandeneynde opened this issue May 21, 2018 · 1 comment

Comments

@robertvandeneynde
Copy link

Hello, currently the precision parameter means the number of digitis after the decimal point but sometimes one want the number of digits to be the precision.

For example, the number 12.345 (1.2345e1) with three digits precision means 12.3 (1.23e1) but the number 1.2345 with three digits precision means 1.23 (1.23e0), one could call it a relative precision. It simple terms, one turns the number in scientific notation then take n digits.

In order to not break with older versions, I suggest to accept a new parameter like digits=3 (mutally exclusive with precision, ie. raises an error if both parameters are given) or def a new function where precision has a diferent meaning.

@kdavies4
Copy link
kdavies4 commented Mar 30, 2020

You may want to consider specifying the number format through the Python format string rather than through a separate precision parameter. That would provide more flexibility and may address this issue. For example see:
hnei@5fd56ba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0