Octave: Boolean AND returns wrong number

32 Views Asked by At

I am trying for several hours to calculate a boolean AND operation in Octave. It return a wrong number.

I want to calculate following numbers: result = 4037 & 63 result should be 5 but i get 1.

I also tried result = and(4037, 63) but i get 1 again

Why is this happening?

1

There are 1 best solutions below

0
Kamil Pajak On BEST ANSWER

Both approaches are not meant to be used for bitwise operations. Instead, you should use bitand function:

result = bitand(4037, 63)