Skip to content
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

How can I print a number's significant figures? #15

Open
ahmadtourei opened this issue Aug 4, 2023 · 1 comment
Open

How can I print a number's significant figures? #15

ahmadtourei opened this issue Aug 4, 2023 · 1 comment

Comments

@ahmadtourei
Copy link

ahmadtourei commented Aug 4, 2023

Hello,

How can I print a number's significant figures?

Thanks!

@ahmadtourei ahmadtourei changed the title How can print a number's significant figures? How can I print a number's significant figures? Aug 4, 2023
@MikeBusuttil
Copy link
Collaborator

hi @ahmadtourei ,

If you mean "How can I get the total number of significant digits from a number given it's uncertainty?" then you could do something like:

>>> len(round('2786273647632', uncertainty=57963, notation='eng').split('E')[0]) - 1
9

As an example with the number 2786273647632 and uncertainty 57963 yielding the total number of significant digits = 9.

If you're looking for something else, could you clarify with an example?

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