Octave:布尔 AND 返回错误数字

问题描述 投票:0回答:1

我尝试了几个小时来计算 Octave 中的布尔 AND 运算。 它返回一个错误的号码。

我想计算以下数字: 结果 = 4037 & 63 结果应该是 5 但我得到 1.

我也尝试过 result = and(4037, 63) 但我再次得到 1

为什么会出现这种情况?

boolean octave boolean-expression boolean-operations octave-gui
1个回答
0
投票

这两种方法都不适合用于按位运算。相反,您应该使用 bitand 函数:

result = bitand(4037, 63)
© www.soinside.com 2019 - 2024. All rights reserved.