Significant figures calculation
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Jun 27 22:56:17 EDT 2011
On Tue, 28 Jun 2011 06:53 am Ethan Furman wrote:
> Harold wrote:
[...]
>>>>> Empirical('1200.').significance
>> 2
Well, that's completely wrong. It should be 4.
>>>>> Empirical('1200.0').significance
>> 5
>
> What about when 1200 is actually 4 significant digits? Or 3?
Then you shouldn't write it as 1200.0. By definition, zeros on the right are
significant. If you don't want zeroes on the right to count, you have to
not show them.
Five sig figures: 1200.0
Four sig figures: 1200
Three sig figures: 1.20e3
Two sig figures: 1.2e3
One sig figure: 1e3
Zero sig figure: 0
--
Steven
More information about the Python-list
mailing list