What is precision of a number representation? (was: Curious Omission In New-Style Formats)

Chris Angelico rosuav at gmail.com
Tue Jul 12 00:36:46 EDT 2016


On Tue, Jul 12, 2016 at 2:19 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On Tue, 12 Jul 2016 07:51 am, Chris Angelico wrote:
>
>> say, 2,147
>> millimeters, with a precision of four significant digits
>
>
> How do you represent 1 mm to a precision of four significant digits, in such
> a way that it is distinguished from 1 mm to one significant digit, and 1 mm
> to a precision of four decimal places?
>
> 0001
> 1
> 1.0000

Exactly my point. Granted, I mucked up my example (subtraction doesn't
maintain sig figs - apologies, my bad), but there are other ways to
end up with numbers close to zero with more sig figs than nonzero
digits.

ChrisA



More information about the Python-list mailing list