[3.1400..01,42,9] //Why 3.140000000000000001 should not have 1 in
the end
Why this happened?
I just realized you were asking two questions there ...
The reason 3.14 didn't get returned as exactly 3.14 is that, in
Python, real numbers are represented in "floating point." This is a
particular scheme for storing numbers in computers that, while
allowing the representation of very large and very small real numbers
and at the same time staying within a strict size, sacrifices the
ability to exactly represent all possible numbers. 3.14 is one of
those numbers.
Wikipedia has an article on floating point numbers here:
http://en.wikipedia.org/wiki/Floating_point
If you can't live with this restriction, you may have to use some
other representation. I'm not sure which (if any) are available with
Python, so someone else will have to weigh in there.
dt.