二进制转换 - 使用 (An x 2)^n...(A0 x 2)^0

Binary Conversion - using (An x 2)^n...(A0 x 2)^0

我在这里错过了什么?我对手写二进制到十进制的转换很陌生,我不明白为什么,至少对我来说,1110 和 1111 看起来都等于 15,但我知道 1110 = 14.

Binary = 1110
n =      3210
calc = (1*2)^3 = 8
       (1*2)^2 = 4
       (1*2)^1 = 2
       (0*2)^0 = 1
       = 15

Binary = 1111
n =      3210
calc = (1*2)^3 = 8
       (1*2)^2 = 4
       (1*2)^1 = 2
       (1*2)^0 = 1
       = 15

我认为你的困惑在于你的公式不正确,它不是 (An*2)^n 而是 An*(2^n) (PEMDAS):

1110
1 * 2^3 = 8
1 * 2^2 = 4
1 * 2^1 = 2
0 * 2^0 = 0
         --- 
          14

1111
1 * 2^3 = 8
1 * 2^2 = 4
1 * 2^1 = 2
1 * 2^0 = 1 
         ---
          15

您的公式(在您的问题标题中)的优先级错误。不是 (An x 2)^n…(A0 x 2)^0,而是 An x (2^n)…A0 x (2^0)

Binary = 1110
n =      3210
calc = 1*2^3 = 1*8 = 8
       1*2^2 = 1*4 = 4
       1*2^1 = 1*2 = 2
       0*2^0 = 0*1 = 0
       = 14

Binary = 1111
n =      3210
calc = 1*2^3 = 1*8 = 8
       1*2^2 = 1*4 = 4
       1*2^1 = 1*2 = 2
       1*2^0 = 1*1 = 1
       = 15