Содержание
- 2. NNSU, 2006 Models and Methods of Programming Positional, or radix notation 383 = 3*100+8*10+3*1 = 3*102+8*101+3*100
- 3. NNSU, 2006 Models and Methods of Programming General positional scheme Theorem. For any integer p>=2, any
- 4. NNSU, 2006 Models and Methods of Programming General positional scheme If p In this case we
- 5. NNSU, 2006 Models and Methods of Programming Overdecimal systems However, if p>10 we may get an
- 6. NNSU, 2006 Models and Methods of Programming Overdecimal systems How to overcome this contradiction? The decision
- 7. NNSU, 2006 Models and Methods of Programming Remainder method The method of transforming a decimal number
- 9. Скачать презентацию
Слайд 2NNSU, 2006
Models and Methods of Programming
Positional, or radix notation
383 = 3*100+8*10+3*1 =
NNSU, 2006
Models and Methods of Programming
Positional, or radix notation
383 = 3*100+8*10+3*1 =
Position of units
Position of hundreds
Position of tens
So, in decimal positional system we use 10 Arabic digits and write the number using powers of the number 10 which is called "radix" of the system.
Слайд 3NNSU, 2006
Models and Methods of Programming
General positional scheme
Theorem. For any integer p>=2,
NNSU, 2006
Models and Methods of Programming
General positional scheme
Theorem. For any integer p>=2,
N = βkpk + βk-1pk-1 + . . . + β2p2 + β1p1 + β0p0 (1)
where coefficients βi are integer and satisfy the inequalities 0<= βi <= p-1
Let's reduce the notation (1) and write the number N as the sequence of coefficients βi:
N = βk βk-1 . . . β2 β1 β0 (2)
The reduced form (2) is called positional representation of the number N in the number system notation with radix p.
Слайд 4NNSU, 2006
Models and Methods of Programming
General positional scheme
If p<=10 all the coefficients
NNSU, 2006
Models and Methods of Programming
General positional scheme
If p<=10 all the coefficients
In this case we have got a simple rule to transform a number written in p-radix system to decimal one. We should just rewrite the number using the form (1) and calculate this expression.
Example.
Transform the number 4235 to the decimal system.
4235 = 4*52 + 2*51 +3*50 = 100 + 10 + 3 = 11310
Слайд 5NNSU, 2006
Models and Methods of Programming
Overdecimal systems
However, if p>10 we may get
NNSU, 2006
Models and Methods of Programming
Overdecimal systems
However, if p>10 we may get
Let's consider p=16 (hexadecimal system) and take the number 30. We can write this number as
30 = 16+14 = 1*161 + 14*160
and with accordance of the rule (1) 30 = 11416 .Let's fulfill the reverse transformation: from hexadecimal system to decimal.
11416 = 1*162 + 1*161 + 4* 160 = 276 !!!
Where is the contradiction?
Only one digit may be placed in one position but we tried to put to the left position the number 14 of two digits. As a result the digit 1 which must be at the second position (on the left) has arisen at the third one and as a consequence have changed its value!
Слайд 6NNSU, 2006
Models and Methods of Programming
Overdecimal systems
How to overcome this contradiction?
The
NNSU, 2006
Models and Methods of Programming
Overdecimal systems
How to overcome this contradiction?
The
A=10, B=11, C=12, D=13, E=14, F=15. As in the informatics hexadecimal system is the greatest one it is not necessary to continue.
So, the number 3010 = 1E16
Example.
12312 = ?10 AAA16 = ?10
Слайд 7NNSU, 2006
Models and Methods of Programming
Remainder method
The method of transforming a decimal
NNSU, 2006
Models and Methods of Programming
Remainder method
The method of transforming a decimal
Example. 11310 = ?5
113 5
10 22 5
13 20 4
10 2
3