On 11/14/06, Carlo Sogono <[EMAIL PROTECTED]> wrote:
I'm attempting to learn Python and have been playing around with it for
the past few days. Why is my output not too smart:

 >>> 8.0 + 0.45
8.4499999999999993

However this seems ok:

 >>> 0.45 + 0.55
1.0

The short answer is that floating point can't represent all values
precisely, it will, in most cases, be an approximation. For a detailed
answer, have a look here.

http://effbot.org/pyfaq/why-are-floating-point-calculations-so-inaccurate.htm

Cheers,

Tim


Cheers,
Carlo


_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

Reply via email to