If the ultimate answer is either 0 or 1, then there is no possibility of it being ‘nearly’ correct. The fact
that computers can sometimes appear to make errors when handling numeric data is due to the
limitation of the size of numbers it can process requiring ‘oversize’ data to be squeezed down to fit
the space available, or truncated, leading to rounding errors. eg 999,999,999 becomes 1,000,000,000.
In a world where the only two numbers available are 0 or 1, how do you then count beyond 1 ?
Bits and Bytes
We just happen to be used to understanding numbers based on the decimal system where the
reference point is the number 10 - ie there are ten digits available to represent quantities in range
from 0 to 9 (which is used in preference to the expression 1 to 10). The system where numbers range
from 0 to 1 is the binary system, and the units in which the system operates are called bits - an
abbreviated form of ‘Binary digiT’. It might be less confusing if you forget all about the decimal
context of the 0 and the 1, and use two totally different symbols to represent their function: fl and *
can be used equally well, as long as there is consistency throughout.
The relationship between bits and decimal notation is simple to understand:
It’s actually conventional to declare the maximum number of binary digits being used by adding
leading zeros to make up the number to the full number of bits:
decimal 7 becomes
00111 binary
using 5 bit notation
In the binary system, the figures may be considered merely as indicators in columns to specify
whether or not a given power 2 is present (l), or not (0).
2
0
= 1
2
l
= 2 = 2 = 2(2
0
)
2
2
= 4 = 2x2 = 2(2
1
)
2
3
= 8 = 2x2x2 = 2(2
2
)
2
4
= 16 = 2x2x2x2 = 2(2
3
)
so the columns look like:
2
4
2
3
2
2
2
l
2
0
1
0
0
1
1
(16
0
0
2
1)
=
19
In order to provide a shorthand method of referring to binary digit information, the term byte is used
to denote 8 bits of information. The highest number that can be stored in a byte is then (binary)
11111111 - or (decimal) 255. This implies 256 actual variations, including 00000000, which is still
perfectly valid data to a computer.
Computers tend to manipulate data in 8 bit multiples. 256 is not a very large number, so in order to
acheieve an acceptable means of handling the memory, two bytes are used to provide a method of
addressing memory which is in the form of an array, with a horizontal and vertical address by which
the elements of that array can be located:
Содержание CPC464
Страница 1: ......
Страница 32: ...or you can type 3e1 1e1 ENTER 300 2 3000x1000 Type 3e3 1e3 ENTER 3000000 3 3000x0 001 Type 3e3 1e 3 ENTER 3 ...
Страница 102: ...PRINT 10 AND 12 Results in 8 PRINT 10 AND 1000 Results in 8 again ...
Страница 118: ...TO DO DRAW THIS PAGE ...
Страница 219: ...actual value may be made to vary during the execution of a program ...
Страница 240: ...Text and WINDOW planner Mode 2 80 Columns ...
Страница 241: ......
Страница 245: ...Sound envelope Music planner sheet ...