[Python-ideas] Way to check for floating point "closeness"?

Ron Adam ron3200 at gmail.com
Wed Jan 14 22:26:07 CET 2015

On 01/14/2015 02:40 PM, Alan Cristhian Ruiz wrote:
> El 14/01/15 a las 17:04, Ron Adam escribió:
>> which brings up the issue with 0.0 -- how many significant digits does 0.0
>> have?

    (as displayed by python)

My point is it needs to track it separately, and not use pythons displayed 
value, or the internal representation.

> When a number is not expressed in scientific
> notation<http://mathworld.wolfram.com/ScientificNotation.html>, the amount
> of significant digits is infinite.
> You can explicitly define the amount of significant figures in scientific
> notation. For example,
> 0.0000e0 contain four significant digits, 2.00 contain infinite, 0.00300e0
> contain three.

 >>> 0.0000e0

See what I mean?


More information about the Python-ideas mailing list