[Top][All Lists]

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

[Octave-bug-tracker] [bug #49168] Wrong results with logical AND

From: Rik
Subject: [Octave-bug-tracker] [bug #49168] Wrong results with logical AND
Date: Fri, 23 Sep 2016 16:01:31 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0

Update of bug #49168 (project octave):

                  Status:                    None => Invalid                
             Open/Closed:                    Open => Closed                 


Follow-up Comment #1:

See the documentation for and:

 -- Z = and (X, Y)
 -- Z = and (X1, X2, ...)
     Return the logical AND of X and Y.

     This function is equivalent to the operator syntax 'x & y'.  If
     more than two arguments are given, the logical AND is applied
     cumulatively from left to right:

          (...((x1 & x2) & x3) & ...)

     At least one argument is required.

     See also: or, not, xor.

The construction

and (0x05, 0x02)

is equivalent to

logical (0x05) & logical (0x02)
true & true

See the function bitand for what you are trying to do.

  -- bitand (X, Y)
     Return the bitwise AND of non-negative integers.

     X, Y must be in the range [0,intmax]

     See also: bitor, bitxor, bitset, bitget, bitcmp, bitshift, intmax,

With your sample input

bitand (0x05, 0x02)
ans = 0


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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