HELP! I don't know binary, hexadecimal, octal, and bit-wise

前端 未结 7 963
不知归路
不知归路 2021-02-10 23:25

I haven\'t learned this in programming class before, but now I need to know it. What are some good resources for learning these numbers and how to convert them? I pretty much am

7条回答
  •  名媛妹妹
    2021-02-10 23:42

    Learning to convert number bases (also known as radixes) is much easier with a radix conversion tool that does all the hard work for you.

    That way you can learn quickly by converting a bunch of numbers to and from different radixes, and see right away the result of the conversion.

    Use this radix converter -- http://www.sooeet.com/math/base-converter.php

    to convert a list of decimal numbers to binary, octal, and hexadecimal (one number at a time).

    Here are two lists of decimal numbers to get you started:

    1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536

    0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535

    The two lists look similar, but produce very different results when you convert them to binary, octal, and hexadecimal. Try it and see.

    To use this number base converter, type a number, or copy and paste any number from the above lists, into the "Base-10" box, and press Enter or Return on your keyboard. The number you entered is converted to binary (base-2), octal (base-8), and hexadecimal (base-16), plus many other number bases (radixes), from base-2 and base-36.

    If you want to better understand radix conversion, read the help pop-ups next to each radix box, to learn about the internal workings of each radix.

    Now, try changing the binary, octal, and hex numbers that you got from converting the above lists, by replacing binary, octal, or hex "digits".

    For example: Decimal 15 = binary 1111

    Now, in the binary result (1111), replace any of the 1 binary digits (bits), with a zero (0) and press Enter or Return on your keyboard.

    In this example: Binary 1101 = decimal 13

    You can see that the second bit from the right in a binary number has a weight of 2 decimal.

    Keep experimenting like this, with decimal, binary, octal, and hexadecimal number conversions, and you will soon master the subject.

提交回复
热议问题