NUMERICAL METHODS
NUMERICAL METHODS
AND
AND
STATISTICS
STATISTICS
NUMERICAL REPRESENTATIONS
NUMERICAL REPRESENTATIONS
Joanna Iwaniec
DECIMAL SYSTEM
DECIMAL SYSTEM
The decimal numeral system (also called base ten or occasionally
denary) has ten as its base.
It is the numerical base most widely used by modern civilizations.
DECIMAL NUMBER SYSTEM
DECIMAL NUMBER SYSTEM
In this system 10 symbols are used:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Any number can be represented as the following sum:
(a
n-1
...a
1
a
0
)
(10)
= a
n-1
*10
(n-1)
+...+ a
1
*10
1
+ a
0
*10
0
=
where:
i – position in a number,
a
i
- any digit from 0 to 9,
n - number of digits (positions) in the number
Example:
425
425
(10)
(10)
= 4*10
= 4*10
2
2
+ 2*10
+ 2*10
1
1
+ 5*10
+ 5*10
0
0
∑
−
=
∗
1
0
10
n
i
i
i
a
Position of units (0)
Position of tens (1)
Position of hundreds (2)
BINARY SYSTEM
BINARY SYSTEM
Two symbols (digits) are used:
0, 1
Any number can be represented as a following sum:
(a
n-1
...a
1
a
0
)
B
= a
n-1
*2
(n-1)
+...+ a
1
*2
1
+ a
0
*2
0
=
where: i – position in a number,
a
i
- digit 0 or 1,
n - number of digits (positions) in the number
Example:
10100
B
= 1*2
4
+ 0*2
3
+ 1*2
2
+ 0*2
1
+ 0*2
0
∑
−
=
∗
1
0
2
n
i
i
i
a
CONVERSION
CONVERSION
1.
1.
2.
2.
10100
B
= 1*2
4
+ 0*2
3
+ 1*2
2
+ 0*2
1
+ 0*2
0
=
= 1*16 + 0*8 + 1*4 + 0*2 + 0*1 = 20
D
20:2 = 10
20:2 = 10
10:2 = 5
10:2 = 5
5:2 = 2
5:2 = 2
2:2 = 1
2:2 = 1
1:2 = 0
1:2 = 0
residual=0
residual=0
residual=1
residual=0
residual=1
D
ir
e
c
tio
n
o
f r
e
a
d
in
g
D
ir
e
c
tio
n
o
f r
e
a
d
in
g
so 20
so 20
D
D
= 10100
= 10100
B
B
HEXADECIMAL NUMERAL SYSTEM
The hexadecimal numeral system, also known as just hex, is a
numeral system made up of 16 symbols (base 16):
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Any number can be represented as:
(a
n-1
...a
1
a
0
)
H
= a
n-1
*16
(n-1)
+...+ a
1
*16
1
+ a
0
*16
0
=
where: i – position in a number,
a
i
– hexadecimal symbol,
n - number of digits (positions) in the number
Example
: 1C2
H
= 1*16
2
+ C*16
1
+ 2*16
0
∑
−
=
∗
1
0
16
n
i
i
i
a
CONVERSION
CONVERSION
1.
1.
2.
2.
1C2
H
= 1*16
2
+ C*16
1
+ 2*16
0
=
= 1*256 + 12*16 + 2*1 = 450
D
450:16 = 28
28:16 = 1
1:16 = 0
residual=2
residual=C
residual=1
D
ir
ec
ti
o
n
D
ir
ec
ti
o
n
o
f
re
a
d
in
g
o
f
re
a
d
in
g
so 450
so 450
D
D
= 1C2
= 1C2
H
H
residues are written in
residues are written in
the hexadecimal form
the hexadecimal form
CONVERSION
CONVERSION
Example values of hexadecimal numbers converted into binary, octal
and decimal:
CONVERSION
CONVERSION
1C2
1C2
H
H
=
=
= 0001 1100 0010 =
= 0001 1100 0010 =
= 000111000010 =
= 000111000010 =
= 111000010
= 111000010
B
B
111000010
111000010
B
B
=
=
=
=
000
000
1 1100 0010
1 1100 0010
B
B
=
=
= 1C2
= 1C2
H
H
ka
ka
ż
ż
d
d
ą
ą
cyfr
cyfr
ę
ę
hex
hex
. zapisujemy w
. zapisujemy w
postaci czw
postaci czw
ó
ó
rki cyfr binarnych
rki cyfr binarnych
odrzucamy nieznacz
odrzucamy nieznacz
ą
ą
ce zera na
ce zera na
pocz
pocz
ą
ą
tku liczby binarnej
tku liczby binarnej
1.
1.
2.
2.
liczb
liczb
ę
ę
binarn
binarn
ą
ą
dzielimy od
dzielimy od
ko
ko
ń
ń
ca na czw
ca na czw
ó
ó
rki ewentualnie
rki ewentualnie
dopisuj
dopisuj
ą
ą
c nieznacz
c nieznacz
ą
ą
ce zera w
ce zera w
ostatniej (pierwszej) czw
ostatniej (pierwszej) czw
ó
ó
rce
rce
ka
ka
ż
ż
d
d
ą
ą
czw
czw
ó
ó
rk
rk
ę
ę
binarn
binarn
ą
ą
zapisujemy w postaci cyfry
zapisujemy w postaci cyfry
hex
hex
.
.
Floating-point notation
In computer systems, real numbers
x
are stored as:
x = M * N
W
where:
M – mantissa of number x
,
W – exponent
(in Polish:
‘wykładnik części potęgowej’),
N – base of power
(in Polish:
‘podstawa potęgi’).
Base N
: 2 or 10 (usually 2)
In the floating point notation real number is represented by two
groups of bits:
M (0.5 ≤ M < 1): interpreted as fractional part (‘część
ułamkowa’),
W: interpreted as integer (‘liczba całkowita’)
Floating-point notation
Example 1
: the following notation:
x = (1)1101
(0)10
M
W
in binary system equals:
-0,1101 * 2
+10
= -(1/2 + 1/4 + 0/8 + 1/16) * 2
+(1*2 +0*1) =
= -3,25
Thank you for your attention!
Thank you for your attention!