A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-February/060821.html below:

[Python-Dev] nice()

[Python-Dev] nice() [Python-Dev] nice()Greg Ewing greg.ewing at canterbury.ac.nz
Mon Feb 13 07:34:57 CET 2006
Smith wrote:

>     When teaching some programming to total newbies, a common frustration
>     is how to explain why a==b is False when a and b are floats computed
>     by different routes which ``should'' give the same results (if
>     arithmetic had infinite precision).

This is just a special case of the problems inherent
in the use of floating point. As with all of these,
papering over this particular one isn't going to help
in the long run -- another one will pop up in due
course.

Seems to me it's better to educate said newbies not
to use algorithms that require comparing floats for
equality at all. In my opinion, if you ever find
yourself trying to do this, you're not thinking about
the problem correctly, and your algorithm is simply
wrong, even if you had infinitely precise floats.

Greg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4