Difference between BCD code and hexadecimal code

Source: Internet
Author: User
For example, for a number: 0000 0010 0011 1111
The hexadecimal format is 23f.
If the code is converted to BCD, because BCD does not have ~ F, then each digit is multiplied by its bit right:
1x1 (0 power of 2) +
1x2 (1 power of 2) +
1x4 (2 to the power) +
1x8 (3 power of 2) +
1x16 (4 power of 2) +
1x32 (5 power of 2) +
0x64 (6 power of 2) +
0x128 (7 power of 2) +
0x256 (Power 8 of 2) +
1x512 (9 power of 2) +
0x1024 (10 power of 2) +
0x2048 (2 to the power of 11) +
0x4096 (12 power of 2) +
0x8192 (13 power of 2) +
0x16384 (14 power of 2) +
0x32768 (the 15th power of 2) = 575
Therefore, the converted BCD code is 0000 0101 0111 0101 (0575)
OK?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.