Created
November 27, 2013 18:04
-
-
Save dheaney/7680253 to your computer and use it in GitHub Desktop.
Return integer number of significant figures from an integer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from math import floor, log10 | |
| def sigfigs(x): | |
| while((x % 10) == 0): | |
| x = x / 10 | |
| return int(floor(log10(abs(x))) + 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment