Skip to content

Instantly share code, notes, and snippets.

@dheaney
Created November 27, 2013 18:04
Show Gist options
  • Select an option

  • Save dheaney/7680253 to your computer and use it in GitHub Desktop.

Select an option

Save dheaney/7680253 to your computer and use it in GitHub Desktop.
Return integer number of significant figures from an integer
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