On Tuesday, 04 November, 2014 15:52:22 Hans-Bernhard Bröker wrote:
> Am 04.11.2014 um 05:48 schrieb Ethan Merritt:
> > Update of /cvsroot/gnuplot/gnuplot
> > In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22050
> >
> > Modified Files:
> > ChangeLog
> > Log Message:
> > if $2 is NaN, plot FOO using 1:(oops=f($2)) should set oops to NaN
>
> I have to disagree with that reasoning. It fails to cover the case
> where f() doesn't actually use its argument arithmetically. E.g. if
>
> f(x) = (x > 0) ? (counter = counter + 1) : counter
>
> then f(NaN) yields the current value of "counter". It doesn't yield
> NaN, so neither should the above "oops" receive such a value.
You are correct that the log message is a simplification of the full story.
The problem was occurring when f($2) used $2 in an arithmetic expression.
This is fixed in the new code. As you note, logical tests are still possible.
Since logical tests against NaN will always return FALSE, it is still
easy to construct incorrect tests in the function definition.
The code change is, I think, correct. The explanation in ChangeLog
is more complete than the 1-line commit message, but could
be expanded further to mention non-arithmetic side effects.
Ethan
|