Computer TipsUnderstand binary (and octal and hexadecimal) numbers |
|
|
Understand binary (and octal and hexadecimal) numbersby Answers 2000 LimitedWhen you get into computing you may come across binary numbers (which are used internally by the computer) as well as hexadecimal or octal numbers. Here's an explanation of how they work: Base 10 In the familiar (base 10) system, each column of a number represents a number times a power of ten (units, tens, hundreds, thousands, etc.). You should also notice that only the digits less than 10, that is to say from 0 to 9, are used in the base 10 system. For example: 1234 = ( 1 * ( 10 ^ 3 ) ) + ( 2 * ( 10 ^ 2 ) ) + ( 3 * ( 10 ^ 1 ) ) + 4 1234 = ( 1 * 1000 ) + ( 2 * 100 ) + ( 3 * 10 ) + 4 Binary (Base 2) In the binary numbering sytem (base 2) each column of numbers represents a number times a power of two (units, twos, fours, eights, etc.). You should also note that only the digits less than 2, that is to say 0 and 1, are used in the binary system. Additionally, it is worth knowing that many binary numbers are written with preceding zeroes. For example: 00001011 (binary) = ( 1 * ( 2 ^ 3 ) ) + ( 0 * ( 2 ^ 2 ) ) + ( 1 * ( 2 ^ 1 ) + 1 00001011 (binary) = ( 1 * 8 ) + ( 0 * 4 ) + ( 1 * 2 ) + 1 00001011 (binary) = 8 + 0 + 2 + 1 00001011 (binary) = 11 (decimal) Octal (Base 8) The octal numbering system (base 8) works on the same principle, except instead of powers of ten (or two), powers of eight are used (units, 8s, 64s, etc.). Only the digits less than 8, namely 0 to 7, are used in the octal numbering system. Hexadecimal (Base 16) The hexadecimal numbering system (base 16) also works on the same principles, except powers of sixteen are used (units, 16s, 256s, etc.). Digits are used in the range 0 to 15 (i.e. less than 16). Since we need a single character representation (a digit) for the numbers 10 to 15, letters are used as digits for values of 10 to 15 (10 is A, 11 is B, 12 is C, 13 is D, 14 is E, 15 is F). Quick Conversion Table You can use this table to translate between bases:
Computer programmers often use octal and hexadecimal as a short hand for binary because each digit in hexadecimal corresponds to 4 binary digits, and each digit in octal corresponds to 3 binary digits. For example: 0101 1111 (binary) = 5F (hexadecimal) = ( 5 * 16 ) + 15 = 95 (base 10) or 0101 1111 (binary) = [0]01 011 111 (binary) = 137 (octal) = ( 1 * 64 ) + ( 3 * 8 ) + 7 = 95 (base 10) Return To Computer Tips Index |
|
| Privacy Terms Of Use Copyright (C) 2004-2007, Answers 2000 Limited |
| In Association With Amazon.com All trademarks are property of their respective owners. All third party content and adverts are copyright of their respective owners. Some graphics on our web sites are Copyright (C) 1997-2000 Hemera Technologies Inc., and used under license. All such pictures are provided for viewing purposes only and are not to be saved or downloaded. All such pictures of recognizable individuals are models and used for illustrative purposes only, and not meant to imply any association or endorsement of said individual with any product or service. |