cool hit counter [On the road to the soft exam] - original code, inverse code, complementary code, shift code_Intefrankly

[On the road to the soft exam] - original code, inverse code, complementary code, shift code


Copyright: This is an original post by the blogger and may not be reproduced without the blogger's permission. https://blog.csdn.net/huyuyang6688/article/details/45267563

The representation of various numerical values in a computer is called machine number, which uses binary numbers to represent data, and the positive and negative signs of the data are also represented by 0 and 1, respectively. To facilitate arithmetic, machine numbers with symbols can be encoded using original code, inverse code, complementary code, shift code, and other encoding methods.

Note: The following rules are all based on machine character length is 8 (i.e., 8 binary bits are used to represent the data) to give an example.

original code

⊙ positive numbers: as follows ① first write the data to be represented, ② write 0 in the sign bit (first bit), ③ fill in with 0 if there is an empty space, e.g. X = 22 = 10110B, then [X] originally = 00010110.

⊙ negative numbers: as follows ① first write the data to be represented, ② write 1 in the first place, ③ if there are empty spaces then fill them with 0, e.g. X = -27 = -11011B, then [X] originally = 10011011.

inverse code

⊙ positive: the inverse is equal to the original, e.g. X = 10110, then [X]inverse = [X]original = 00010110.

⊙ Negative numbers: as follows, based on the original code, ④ the sign bit (first bit) remains unchanged, ⑤ the other bits are inverted by bit (0 becomes 1,1 becomes 0), e.g. X = -11011, then [X] original = 10011011, [X] inverse = 11100100.

binary code with 0 and 1 interchanged

⊙positive number:binary code with 0 and 1 interchanged tantamount to original code harmony inverse code, as ifX=10110, follow[X] patch=[X] contrary=[X] primary=00010110;

⊙ Negative: on top of the inverse code, (6) let the inverse code add 1. For example, if X = -11011, then [X] original = 10011011, [X] inverse = 11100100, [X] complement = 11101101.

swift code

Both positive and negative shifts are based on the inverse code by letting the sign bit of the inverse code be inverted, which gives the shift code for that number. If X=-11011, then [X]original=10011011, [X]inverse=11100100, [X]complement=11100101, and [X]shift=01100101.

replenish: fractional original code、 inverse code、binary code with 0 and 1 interchanged、 swift code conversions

The conversion between the representations of original code, inverse code, complement code, and shift code is basically only a little different when converting positive and negative numbers, and when it comes to decimals, you just need to represent the decimals as binary as well, and convert them in the same way as positive numbers. If X = 0.25 = 0.01, [X]original = 0.0100000, [X]inverse = 0.1011111, [X]complement = 0.1100000, and [X]shift = 1.1100000.


Recommended>>
1、YEE Next Generation Blockchain Communication Network
2、The database management system provides a twotier mapping mechanism for the threetier schema structure where the schemain schema mapping provides
3、Bopantos 2017 Continental Market Storage Product Awards Crowd Pickup
4、Blockchain Shares Top 50 Global Blockchain Innovations 2018
5、Merculet Invited to BeeStore Developer Retreat to Power DAPP Distribution

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号