Evaluation of binary expression

Moritz Borgmann octave at moriborg.de
Mon Apr 7 13:48:07 CDT 2008


At 11:05 Uhr -0700 2008-04-07, Ben Abbott wrote:
>  >The problem obviously is in line 90 of cgs.m (my version of it), which is
>>
>>if ((nargin >= 5) & ~isempty(M1))
>>
>  >I tend to say that the evaluation of the second expression of the 
>binary operator `&' should be suppressed in case the evaluation of 
>the first expression did already provide a negative result.

this should be covered by the FAQ:

http://www.gnu.org/software/octave/FAQ.html#MATLAB-compatibility

item 10, search for "short-circuit". This can basically be considered 
a Matlab bug. IMO, if you change the "&" to a "&&", you should be up 
& running.

I take this to the octave-help list since it's not really a bug in Octave.

-M


More information about the Help-octave mailing list