help-octave
[Top][All Lists]
Advanced

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

Re: bug in a(a<3)?


From: dirk
Subject: Re: bug in a(a<3)?
Date: Mon, 6 Sep 1999 14:42:54 +0200 (SAST)

Daniel Heiserer wrote:
> 
> Hi it seems that I found something really strange.
> octave:1> a=rand(3)
> octave:2> a(a<3)
> octave:3> a(a<0.4))
> For me it seems that octave makes it right for 0.4 but wrong for 3.

If you look at (a<3) it comes out all ones, while (a<0.4) with a high
probability comes out with at least one zero.  Octave can in the latter
case deduce that you want to select items, but in the first case it
is ambiguous and the result depends on how you've set a certain built-in
variable (another reply to your query gives the name of the variable).
Your default setting obviously treats [1 1 1] as three copies of '1'
and not as three cases of "yes, include me."

Dirk



---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

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