开发者

Converting 3.333333333 to base 2

Converting 0.3 is easy [mul it by 2] , if the precision is 开发者_运维问答0.1:

A) 0.3 -> 0.6  - >  extract 0
B) 0.6 -> 1.2  - >  extract 1
C) 0.2 -> 0.4  - >  extract 0
D) 0.4 -> 0.8  - >  extract 0
E) 0.8 -> 1.6  - >  extract 1
F) 0.6 jump to B

So the 3.3 = 00000011.010011001100110011001

And Now What should We Do with 3.3333333333333333333333 ? if the precision is 0.01.


You could do the same? =)

a 1/3 -> 2/3  -> extract 0
b 2/3 -> 4/3  -> extract 1
c 1/3 -> GOTO a

so 0.3333333333333(etc..) is 0.01010101010101(etc) in base 2.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜