Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Computer number format
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Octal and hexadecimal number display== {{See also|Base64}} [[Octal]] and hexadecimal encoding are convenient ways to represent binary numbers, as used by computers. Computer engineers often need to write out binary quantities, but in practice writing out a binary number such as 1001001101010001 is tedious and prone to errors. Therefore, binary quantities are written in a base-8, or "octal", or, much more commonly, a base-16, "hexadecimal" (''hex''), number format. In the decimal system, there are 10 digits, 0 through 9, which combine to form numbers. In an octal system, there are only 8 digits, 0 through 7. That is, the value of an octal "10" is the same as a decimal "8", an octal "20" is a decimal "16", and so on. In a hexadecimal system, there are 16 digits, 0 through 9 followed, by convention, with A through F. That is, a hexadecimal "10" is the same as a decimal "16" and a hexadecimal "20" is the same as a decimal "32". An example and comparison of numbers in different bases is described in the chart below. When typing numbers, formatting characters are used to describe the number system, for example 000_0000B or 0b000_00000 for binary and 0F8H or 0xf8 for hexadecimal numbers. ===Converting between bases=== {| class="wikitable" style="float: right; clear:right; margin-left:1em; text-align:right;" |+ Table 3: Comparison of values in different bases |- ! Decimal !! Binary !! Octal !! Hexadecimal |- | 0 || 000000 || 00 || 00 |- | 1 || 000001 || 01 || 01 |- | 2 || 000010 || 02 || 02 |- | 3 || 000011 || 03 || 03 |- | 4 || 000100 || 04 || 04 |- | 5 || 000101 || 05 || 05 |- | 6 || 000110 || 06 || 06 |- | 7 || 000111 || 07 || 07 |- | 8 || 001000 || 10 || 08 |- | 9 || 001001 || 11 || 09 |- | 10 || 001010 || 12 || 0A |- | 11 || 001011 || 13 || 0B |- | 12 || 001100 || 14 || 0C |- | 13 || 001101 || 15 || 0D |- | 14 || 001110 || 16 || 0E |- | 15 || 001111 || 17 || 0F |} {{Main | Positional_notation#Base_conversion| l1=Positional notation (base conversion) }} Each of these number systems is a positional system, but while decimal weights are powers of 10, the octal weights are powers of 8 and the hexadecimal weights are powers of 16. To convert from hexadecimal or octal to decimal, for each digit one multiplies the value of the digit by the value of its position and then adds the results. For example: : <math> \begin{align} & \text{octal } 756 \\[5pt] = {} & (7 \times 8^2) + (5 \times 8^1) + (6 \times 8^0) \\[5pt] = {} & (7 \times 64) + (5 \times 8) + (6 \times 1) \\[5pt] = {} & 448 + 40 + 6 \\[5pt] = {} & \text{decimal } 494 \end{align} \qquad \begin{align} & \text{hex } \mathrm{3b2} \\[5pt] = {} & (3 \times 16^2) + (11 \times 16^1) + (2 \times 16^0) \\[5pt] = {} & (3 \times 256) + (11 \times 16) + (2 \times 1) \\[5pt] = {} & 768 + 176 + 2 \\[5pt] = {} & \text{decimal } 946 \end{align} </math>
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Computer number format
(section)
Add topic