octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #59103] inputname() is incorrect for string-li


From: Sébastien Kalbusch
Subject: [Octave-bug-tracker] [bug #59103] inputname() is incorrect for string-like numeric inputs such as Inf, NaN, i
Date: Tue, 15 Sep 2020 14:15:55 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0

Follow-up Comment #1, bug #59103 (project octave):

Hello,

I have had a look at the implementation of inputname and I think the usage of
"isvarname" is incorrect. I was expecting isvarname("Inf") to be 0 but I get:


octave:1> isvarname("Inf")
ans = 1


I believe that the "exist" function would achieve the intended result.
"inputname" could return an empty string if "exist(NAME)" gives a result
different than 1 (meaning that NAME is a variable).

octave:2> exist("Inf")
ans =  5


For this to work, "exist" must be evaluated in the base context though. So it
would look like this

  valid = evalin ("base", sprintf ("exist (\"%s\")", name));
  if (valid != 1)
    name = "";
  endif

instead of

  if (! isvarname (name))
    name = "";
  endif


I am new here so I am not sure if this is correct.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59103>

_______________________________________________
  Message posté via Savannah
  https://savannah.gnu.org/




reply via email to

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