|
From: Daniel J S. <dan...@ie...> - 2006-05-29 22:20:17
|
This seems like a bug, even though the syntax is incorrect... but a user might think the syntax is correct if gnuplot doesn't complain but rather returns a non-zero value that will always test positive.
gnuplot> print defined("foo")
141158968
gnuplot> print defined("foo")
141159440
gnuplot> print defined("foo")
141159544
gnuplot> print defined("foo")
141159880
gnuplot> print defined("foo")
141160112
gnuplot> print defined("foo")
141160216
Also, would it be useful to extend defined() from just variables to functions as well? Say, return 1 if user defined variable, 2 if internal variable, 3 if user defined function, 4 if internal function.
That way, the defined() function could be used inside stat.inc as
if (defined(gamma)!=3) gamma(x) = exp(lgamma_nat(x))
then get rid of these comments like:
# If you have the lgamma() function compiled into gnuplot, you can use
# alternate definitions for some PDFs. For larger arguments this will result
# in more efficient evalution. Just uncomment the definitions containing the
# string `lgamma', while at the same time commenting out the originals.
# NOTE: In these cases the recursive definition for lgamma() is NOT sufficient!
As soon as someone starts uncommenting/commenting code it becomes confusing.
Last, how about an internally defined 'eps' or something similar to represent float machine precision?
Oh, one other thing. Any interest in a complex version of the gamma function?
Dan
|