Counting significant figures in Python?

user456584 picture user456584 · Nov 12, 2011 · Viewed 8.4k times · Source

Is there a way in Python to count the significant figures in a double/float/etc? I'm not seeing an easy way to do this, but I'd expect it to be in the library.

Thanks in advance.

Answer

Mr.Wizard picture Mr.Wizard · Nov 13, 2011

You may be interested in an arbitrary precision floating point library such as this one:

http://code.google.com/p/mpmath/