[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (0 <= i && i < N) is not "backwards"

From: Eli Zaretskii
Subject: Re: (0 <= i && i < N) is not "backwards"
Date: Mon, 25 Mar 2013 10:20:06 +0200

> Date: Sun, 24 Mar 2013 16:14:49 -0700
> From: Paul Eggert <address@hidden>
> Cc: Emacs Development <address@hidden>
> Emacs trunk bzr 112126, installed with the commit log
> "Reorder conditions that are written backwards",
> changed a lot of Emacs code, typically to replace expressions
> like "0 < i" with expressions like "i > 0".
> This sort of stylistic change shouldn't be introduced without
> discussion.

Out of fairness, you introduced this style into Emacs sources in the
first place without any discussions that I could remember or find in
the archives.  If we want to discuss stylistic changes before
committing them, let's do that no matter who is the committer.

> In one or two places the change may have introduced a bug,
> as "! (0 < X)" is not equivalent to "X <= 0" when
> X is floating point, because of NaNs.

If we want our code to be robust in the face of NaNs, we should
probably use 'isnan' explicitly, because (as you know very well) every
comparison with a NaN yields zero, a.k.a. false.  OTOH, whether a NaN
should be considered greater or less than zero in the Emacs context is
debatable, IMO.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]