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 |
Disclosure: Our company's websites' content (including this website's content) includes advertisements for our own company's websites, products, and services, and for other organization's websites, products, and services. In the case of links to other organization's websites, our company may receive a payment, (1) if you purchase products or services, or (2) if you sign-up for third party offers, after following links from this website. Unless specifically otherwise stated, information about other organization's products and services, is based on information provided by that organization, the product/service vendor, and/or publicly available information - and should not be taken to mean that we have used the product/service in question. Additionally, our company's websites contain some adverts which we are paid to display, but whose content is not selected by us, such as Google AdSense ads. For more detailed information, please see Advertising/Endorsements Disclosures Our sites use cookies, some of which may already be set on your computer. Use of our site constitutes consent for this. For details, please see Privacy. Click privacy for information about our company's privacy, data collection and data retention policies, and your rights. Contact Us Privacy Terms Of Use Advertising/Endorsements Disclosures Copyright © 2004-2020, Answers 2000 Limited CERTAIN CONTENT THAT APPEARS ON THIS SITE COMES FROM AMAZON SERVICES LLC. THIS CONTENT IS PROVIDED 'AS IS' AND IS SUBJECT TO CHANGE OR REMOVAL AT ANY TIME. CERTAIN CONTENT THAT APPEARS ON THIS SITE,COMES FROM AMAZON EU S.à r.l. THIS CONTENT IS PROVIDED 'AS IS' AND IS SUBJECT TO CHANGE OR REMOVAL AT ANY TIME. In Association With Amazon.com Answers 2000 Limited is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. In Association With Amazon.co.uk Answers 2000 Limited is a participant in the Amazon EU Associates Programme, an affiliate advertising programme designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.co.uk. As an Amazon Associate, our company earns from qualifying purchases. Amazon, the Amazon logo, Endless, and the Endless logo are trademarks of Amazon.com, Inc. or its affiliates. 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. |