Professional Documents
Culture Documents
Number Systems
Four number system Decimal (10) Binary (2) Octal (8) Hexadecimal (16)
Binary numeral system
Humans use the decimal number system to per orm arithmetic operations! "omputers use the binary system to represent numbers internally# $hich contains only t$o di%its& 0 and 1! 'e need a $ay to con(ert numbers rom one system to another! )he smallest unit o stora%e in the computer is the bit# $hich stands or binary di%it! * bit can hold one o t$o (alues# 0 or 1 )he 0 and 1 (alues are o ten interpreted as alse and true# or as an electrical impulse bein% o and on!
The octal numeral system
)he octal numeral system# or oct or short# is the base+8 number system# and uses the di%its 0 to ,! -umerals can be made rom binary numerals by %roupin% consecuti(e binary di%its into %roups o three (startin% rom the ri%ht)! For example# the binary representation or decimal ,. is 1001010# $hich can be %rouped into (00)1 001 010 / so the octal representation is 112!
The Hexadecimal Numeral System
Hexadecimal (also base 16# or hex) is a positional numeral system $ith a radix# or base# o 16! 0t uses sixteen distinct symbols# most o ten the symbols 0+1 to represent (alues 2ero to nine# and *# B# "# D# 3# F (or alternati(ely a throu%h ) to represent (alues ten to i teen! 3ach hexadecimal di%it represents our binary di%its (bits) (also called a 4nibble4)# and the primary use o hexadecimal notation is as a human+ riendly representation o binary coded (alues in computin% and di%ital electronics! For example# byte (alues can ran%e rom 0 to 255 (decimal) but may be more con(eniently represented as t$o hexadecimal di%its in the ran%e 00 throu%h FF! Hexadecimal is also commonly used to represent computer memory addresses!
Decimal numbers
. x 102 8 Hundreds
6 x 101 8 )ens
1 x 100 Ones
)o con(ert inte%er decimals to binary# di(ide the ori%inal number by the lar%est possible po$er o 2 and successi(ely di(ide the remainders by successi(ely smaller po$ers o 2 until the po$er is 1! )he binary representation is ormed by the :uotients# $ritten in the order %enerated by the al%orithm! 16 6 6 1 0
Decimal to Octal
2 2 2 2
1 0 1 1
;east si%ni icant bit <ost si%ni icant bit (16)10 7 (1101)2
)o con(ert inte%er decimals to octal# di(ide the ori%inal number by the lar%est possible po$er o 8 and successi(ely di(ide the remainders by successi(ely smaller po$ers o 8 until the po$er is 1! )he octal representation is ormed by the :uotients# $ritten in the order %enerated by the al%orithm!
15 11 1 0
Decimal to Hexadecimal
8 8 8
, 6 1
;east si%ni icant octal di%it <ost si%ni icant octal di%it (16)10 7 (16,)8
)o con(ert inte%er decimals to hex# di(ide the ori%inal number by the lar%est possible po$er o 16 and successi(ely di(ide the remainders by successi(ely smaller po$ers o 16 until the po$er is 1! )he hexadecimal representation is ormed by the :uotients# $ritten in the order %enerated by the al%orithm! 218 1 11 1 0 (16)10 7 (B*D)16 *710# B711# "712# D716# 371.# F715
Binary to Decimal
1 6 1 6 1 6
1 6 1 0 1 1
7 11 x 256 8 10 x 16 8 16 x 1 7 2816 8 160 8 16 (B*D)16 7 (2181)10 * 7 10# B 7 11# " 7 12# D 7 16# 3 7 1.# F 7 15
Why octal or hex?
3ase o use and con(ersion )hree bits ma>e one octal di%it 111 010 110 101 , 2 6 5 7? ,265 in octal Four bits ma>e one hexadecimal di%it 1110 1011 0101 3 B 5 7? 3B5 in hex
Binary *ddition 0101 (5) 8 1001 (1) 1110 (1.) " # $ Binary @ubtraction 1001 (1) + 0101 (5) 0100 (.) % # $ # 0 1 $ 1 1 0 # 0 1 $ 1 1 0