user456584 user456584 - 1 year ago 103
Python Question

Counting significant figures in Python?

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 Source

No. Significant digits are just not that big a deal and get little support in computer languages. People doing real computations need error bars, which have far more precision — real measurements say very exact things like “this is 0.11 ± 0.03mm“ instead of saying either of the less exact statements “this is 0.1 mm” or “this is 0.11 mm” which makes you choose a power of ten even if your inexactness does not actually fall at a power of ten.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download