[Tutor] If elif not working in comparison

Jeff Shannon jeffshannon at gmail.com
Tue Mar 29 01:15:37 CEST 2005


On Mon, 28 Mar 2005 09:27:11 -0500, orbitz <orbitz at drorbitz.ath.cx> wrote:
> Floats are inherintly inprecise.  So if thigns arn't working like you
> expect don't be surprised if 0.15, 0.12, and 0.1 are closer to the same
> number than you think.

However, the imprecision of floats is in the 10-12 precision digit
range.  That is, it's precise up to about 0.0000000001 (or slightly
fewer decimal places if the integer part is large).  Given the
precision with which those constants are specified, I doubt that float
imprecision will be an issue here, unless there's a *lot* of repeated
operations, e.g. a loop with many (i.e. hundreds to thousands of)
iterations.

Jeff Shannon


More information about the Tutor mailing list