User Tools

Site Tools


notes:c4eng:fall2022:projects:dtr0

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:c4eng:fall2022:projects:dtr0 [2022/09/07 14:44] – [BINARY NUMBERS] lbrant2notes:c4eng:fall2022:projects:dtr0 [2023/09/08 14:31] (current) – [BINARY NUMBERS] nbutler5
Line 13: Line 13:
 (These are equivalent to the values 0 through 16 in the decimal number system) (These are equivalent to the values 0 through 16 in the decimal number system)
  
-Computers will always convert the numbers from any number system into binary for the purposes of consistent computation, and convert them back into their original number system once finished with these computations. For example, say someone wanted perform the computation 3 + 2 in the decimal number system. A computer would convert these values into the binary values of 000011 and 000010, respectively, compute the binary value 000101 from these values, and convert this value back into the decimal value of 5.+Computers will always convert the numbers from any number system into binary for the purposes of consistent computation, and convert them back into their original number system once finished with these computations. For example, say someone wanted to perform the computation 3 + 2 in the decimal number system. A computer would convert these values into the binary values of 000011 and 000010, respectively, compute the binary value 000101 from these values, and convert this value back into the decimal value of 5.
  
 When you say a binary number, pronounce each digit (example, the binary number "101" is spoken as "one zero one", or sometimes "one-oh-one"). This way people don't get confused with the decimal number. When you say a binary number, pronounce each digit (example, the binary number "101" is spoken as "one zero one", or sometimes "one-oh-one"). This way people don't get confused with the decimal number.
Line 26: Line 26:
  
 Because the hexadecimal base of 16 can also be written as 2^4, this makes converting between binary and hexadecimal much more intuitive than that of decimal. Each digit of the hexadecimal number system can be represented by a specific set of four digits in the binary number system. One can represent larger hexadecimal values in binary by combining strings of binary numbers in these sets of four digits. For example, let's take the binary number 01011010. This binary number can be split into two smaller binary numbers, 0101 and 1010, each with four digits. Individually, these equal 0x05 and 0x0A, respectively, in the hexadecimal number system. Combining these two binary numbers into one number thus yields 0x5A in hexadecimal. Because the hexadecimal base of 16 can also be written as 2^4, this makes converting between binary and hexadecimal much more intuitive than that of decimal. Each digit of the hexadecimal number system can be represented by a specific set of four digits in the binary number system. One can represent larger hexadecimal values in binary by combining strings of binary numbers in these sets of four digits. For example, let's take the binary number 01011010. This binary number can be split into two smaller binary numbers, 0101 and 1010, each with four digits. Individually, these equal 0x05 and 0x0A, respectively, in the hexadecimal number system. Combining these two binary numbers into one number thus yields 0x5A in hexadecimal.
 +
 +In hex, four digits of a binary number can be represented by a single hex digit. Dividing a binary number into 4-bit sets means that each set can have a possible value of between 0000 and 1111, allowing 16 number combinations from 0 to 15. With the base value as 16, the maximum value of a digit is 15.
 =====DATA TYPES IN C===== =====DATA TYPES IN C=====
  
notes/c4eng/fall2022/projects/dtr0.1662561882.txt.gz · Last modified: 2022/09/07 14:44 by lbrant2