[Python-ideas] [Python-Dev] The Case Against Floating Point ==
Jim Jewett
jimjjewett at gmail.com
Tue Mar 18 23:42:28 CET 2008
On 3/14/08, Imri Goldberg <lorgandon at gmail.com> wrote:
> Alright, I agree it's a good idea to drop the proposal to changing
> floating point == into an epsilon compare.
> What about issuing a warning though?
> Consider the following course of action. It is the one with the least
> changes:
> == for regular floating point numbers now issues a warning, but still
> works. This warning might be turned off. All other operators are left
> unchanged.
If you change ==, you should really change !=, and probably the other
comparisons as well.
I suspect what you really want is a warning on any usage of a floating
point. And I'm only half-joking. Comparison (or arithmetic) with
other floats adds error. Comparison (or arithmetic) with ints is
*usually* a bug (unless one of the operands is a constant that someone
was too lazy to write correctly).
-jJ
More information about the Python-ideas
mailing list