本来就是二进制乘法的做法


所有跟贴·加跟贴·新语丝读书论坛

送交者: Yush 于 2008-08-27, 18:30:24:

回答: 埃塞俄比亚算数:think like a computer 由 silxirt 于 2008-08-27, 17:50:20:

引用:

http://en.wikipedia.org/wiki/Multiplication_ALU
1011 (this is 11 in decimal)
x 1110 (this is 14 in decimal)
======
0000 (this is 1011 x 0)
1011 (this is 1011 x 1, shifted one position to the left)
1011 (this is 1011 x 1, shifted two positions to the left)
+ 1011 (this is 1011 x 1, shifted three positions to the left)
=========
10011010 (this is 154 in decimal)

乘以2 相当于二进制各位左移一位后右补0
遇到偶数(二进制末位为0)把中间和删掉,相当于乘以二进制0




所有跟贴:


加跟贴

笔名: 密码: 注册笔名请按这里

标题:

内容: (BBCode使用说明