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

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

[Octave-bug-tracker] [bug #53007] Variable editor: logical values are tr


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #53007] Variable editor: logical values are transformed to doubles upon editing
Date: Mon, 29 Jan 2018 17:43:59 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

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

Oh.  I think this only happens with scalar logical values.

The variable editor is just evaluating an expression like


x(1,1) = new_value;


in the interpreter.  For arrays, the type remains the same, even for logicals.
 But I do see the warning


warning: value not equal to 1 or 0 converted to logical 1


But for scalars, even the expression


x(1,1) = 1


will change a scalar logical value to double.

I suppose you are right that applying the class constructor to the RHS should
fix this problem.  And also avoid the warning in the matrix case.

However, for numeric types, I'm not sure that we want to force the type to
remain the same.  What does Matlab do (for logical, and numeric types, scalar
and array)?  (Not that I will agree with it, but it might avoid future bug
reports from surprised Matlab users).

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53007>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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