F 1 = a -2 * 1/2 + a -3 *1/2 2 +

advertisement
NUMERIC SYSTEMS
The Decimal System
It may not have occurred to you, but in everyday life you use a system based on digits
to represent numbers. In this case, we use decimal digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) and
refer to the system as the decimal system.
Consider what the number 83 means. It means eight tens plus three:
83=8*10+3
The number 4,728 means four thousands, seven hundreds, two tens, plus eight:
4728=4*1000 + 7*100 + 2*10 + 8
The decimal system is said to have a base, or radix, of ten. This means that each digit
in the number is multiplied by ten raised to a power corresponding to that digit's
position. Thus,
83 = 8 * 101 + 3 * 100
4728=4*103 + 7*102 + 2*101 + 8*100
Fractional values are represented in the same fashion. Thus,
472.83=4*102+ 7*101+2*100+8*10-1 +3*10-2
In general, for
Decimal representation of X ={... x2x1x0 . x-1x-2x-3...}
the value of X is
X =  xi10i
The Binary System
In the decimal system, ten different digits are used to represent numbers with a base of
ten. In the binary system, we have only two digits, 1 and 0. Thus numbers in the
binary system are represented to the base two.
To avoid confusion, we will sometimes put a subscript on a number to indicate its
base. For example 83 and 4728 are numbers represented in decimal notation, or more
briefly, decimal numbers. Now, 1 and 0 in binary notation have the same meaning as
in decimal notation:
02 = 010
12=110
How do we represent larger numbers? As with decimal notation, each digit in a binary
number has a value depending on its position:
102 = 1 * 21 + 0 * 20 = 210
112 = 1 * 21 + 1 * 20 = 310
100 = 1 * 22 + 0 * 21 + 0 * 20 = 410
and so on.
Again, fractional values are represented with negative powers of the radix:
1001.101 = 23 + 20 + 2-1 + 2-3
Converting Between Binary and Decimal
It is a simple matter to convert a number from binary notation to decimal notation. In
fact, we showed several examples in the previous subsection. All that is required is to
multiply each binary digit by the appropriate power of 2 and add the results.
To convert from decimal to binary, the integer and fractional parts are handled
separately. Suppose it is required to convert a decimal integer N into binary form. If
we divide N by 2, in the decimal system, and obtain a quotient N1 and a remainder r1,
we may write
N = 2* N1 + r1 r1 = 0 or 1
Next we divide the quotient N1 by 2. Assume that the new quotient is N2 and the new
remainder r2. Then
N1 = 2 * N2 + r2 r2 = 0 or 1
so that
N = 2(2N2 + r2) + r1 = 22N2 + r2 * 21 + r1 * 20
If next
N2 - 2N3 + r3
we have
N = 23N3 + r3 * 22 + r2 * 21 + r1* 20
Continuing thus, since N> N1>N2...., we must eventually obtain a quotient Nk = 1 and
a remainder rk which is 0 or 1. Then
N = 1 * 2k + rk * 2k-1 + ... + r3* 22 + r2* 21 + r1* 20
That is, we convert from base 10 to base 2 by repeated divisions by 2. The remainders
and the final quotient, 1, give us, in order of increasing significance, the binary digits
of N.
The fractional part involves repeated multiplication by 2. At each step, the fractional
part of the decimal number is multiplied by 2. The digit to the left of the decimal point
in the product will be 0 or 1 and contributes to the binary representation, starting with
the most significant bit. The fractional part of the product is used as the multiplicand
in the next step. To see that this works, let us take a positive decimal fraction F < 1.
We can express F as
F=a-1*1/2+a-2*1/22+a-3*1/23+ ...
where each a-i is 0 or 1. If we multiply this by 2, we obtain
2F = a-1 + a-2*1/2 + a-3*1/22 + ...
The integer parts of these two expressions must be equal. Hence the integer part 2F,
which must be either 0 or 1 since 0 < F < 1, is simply a-1. Thus 2F = a-1+ F1where 0 <
F1< 1 and where
F1 = a-2* 1/2 + a-3*1/22 + ...
To find a-2we now repeat the process. This process is not necessarily exact; that is, a
decimal fraction with a finite number of digits may require a binary fraction with an
infinite number of digits. In such cases, the conversion algorithm is usually halted
after a prespecified number of steps, depending on the desired accuracy.
Hexadecimal Notation
Because of the inherent binary nature of digital computer components, all forms of
data within computers are represented by various binary codes. We have seen
examples of binary codes for text and binary notation for integers. Later, we shall see
examples of the use of binary codes for other types of data. However, no matter how
convenient the binary system is for computers, it is exceedingly cumbersome for
human beings. Consequently, most computer professionals who must spend time
working with the actual raw data in the computer prefer a more compact notation.
What notation to use? One possibility is the decimal notation. We have seen that
every binary number has a decimal equivalent. This is certainly more compact than
binary notation, but it is awkward because of the tediousness of converting between
base 2 and base 10.
Instead, a notation known as hexadecimal has been adopted. Binary digits are grouped
into sets of 4. Each possible combination of 4 binary digits is given a symbol, as
follows:
0000 = 0 1000 = 8
0001 = 1 1001 = 9
0010 = 2 1010 = A
0011 = 3 1011 = B
0100 = 4 1100 = C
0101 = 5 1101 = D
0110 = 6 1110 = E
0111 = 7 1111 = F
Since 16 symbols are used, the notation is called hexadecimal, and the 16 symbols are
the hexadecimal digits.
A sequence of hexadecimal digits can be thought of as representing an integer in base
16. Thus,
1A16 = 116 * 161 + A16* 160 = l10*161+ l010*160=26
But hexadecimal notation is not used just for representing integers. It is used as a
concise notation for representing any sequence of binary digits, whether they
represent text, numbers, or some other type of data. The reasons for using
hexadecimal notation are
1. It is more compact than binary notation.
2. In most computers, binary data occupy some multiple of 4 bits, and hence
some multiple of a single hexadecimal digit.
3. It is extremely easy to convert between binary and hexadecimal.
As an example of the last point, consider the binary string 110111100001. This is
equivalent to
1101 1110 0001 = DE116
DE1
This process is performed so naturally that an experienced programmer can mentally
convert visual representations of binary data to their hexadecimal equivalent without
written effort. It is quite possible that you will never need this particular skill.
Nevertheless, since you may encounter hexadecimal notation, this discussion has been
included in the text.


Decimal has ten different digits - 0 1 2 3 4 5 6 7 8 9 Binary only has two different digits 01
The difference between the decimal system and the Dewey decimal system?
the Dewey decimal system incorporates letters into it like a library book could be labeled
cla 123.45 and is the Dewey decimal system, but something labelled 123.4 is just the
decimals

What are the differences between the binary and the decimal numbers?
Binary is base 2, decimal is base 10. Base 10 positions from the decimal point are tens,
hundreds, thousands, etc etc. - each one ten times the previous. Base 2 positions from the
decimal point are...

What is the difference between a binary star system and our star system?
A binary star system has two stars in the same system; our solar system has only one star.

Difference between binary and decimal numbers?
The binary system has only two digits: 0 and 1The decimal has ten digits: 0, 1, 2, 3, 4, 5,
6, 7, 8 and 9In binary, numbers are expressed as linear combinations of powers of 2 as
in13 = 1*23 + 1*22 +...
How many bytes = 1 KB? how many KB = 1 MB? and how many MB?
8 Bits = 1 Byte
1024 Bytes = 1 KiloByte
1024 KiloBytes = 1 MegaByte
1024 MegaBytes = 1 GigaByte
1024 GigaBytes = 1 TeraByte
untuk byte, bukan pakai kelipatan 10, namun menggunakan pemangkatan 2
1 KiloByte= 2^10 byte
1 MegaByte = 2^10 kiloByte = 2^20 byte
1 GigaByte = 2^10 MegaByte = 2^20 kiloByte = 2^30 Byte
tapi yang perlu diingat juga, untuk koneksi internet, 1 Byte = 8 bit
Bits, Bytes, Mega, Giga, Tera (explained)
1 bit = a 1 or 0 (b)
4 bits = 1 nybble (?)
8 bits = 1 byte (B)
1024 bytes = 1 Kilobyte (KB)
1024 Kilobytes = 1 Megabyte (MB)
1024 Megabytes = 1 Gigabyte (GB)
1024 Gigabytes = 1 Terabyte (TB)
Common prefixes:
- kilo, meaning 1,000. (one thousand) 10^3 (Kilometer, 1,000 meters)
- mega, meaning 1,000,000. (one million) 10^6 (Megawatt, 1,000,000 watts)
- giga, meaning 1,000,000,000 (one billion) 10^9 (Gigawatt, 1,000,000,000 watts)
- tera, meaning 1,000,000,000,000 (one trillion) 10^12
The smallest amount of transfer is one bit. It holds the value of a 1, or a 0. (Binary coding). Eight
of these 1's and zero's are called a byte.
Why eight? The earliest computers could only send 8 bits at a time, it was only natural to start
writing code in sets of 8 bits. This came to be called a byte.
A bit is represented with a lowercase "b," whereas a byte is represented with an uppercase "b"
(B). So Kb is kilobits, and KB is kilobytes. A kilobyte is eight times larger than a kilobit.
A simple 1 or 0, times eight of these 1's and 0's put together is a byte. The string of code:
10010101 is exactly one byte. So a small gif image, about 4 KB has about 4000 lines of 8 1's and
0's. Since there are 8 per line, that's over (4000 x 8) 32,000 1's and 0's just for a single gif image.
How many bytes are in a kilobyte (KB)? One may think it's 1000 bytes, but its really 1024. Why
is this so? It turns out that our early computer engineers, who dealt with the tiniest amounts of
storage, noticed that 2^10 (1024) was very close to 10^3 (1000); so based on the prefix kilo, for
1000, they created the KB. (You may have heard of kilometers (Km) which is 1000 meters). So
in actuality, one KB is really 1024 bytes, not 1000. It's a small difference, but it adds up over a
while.
The MB, or megabyte, mega meaning one million. Seems logical that one mega (million) byte
would be 1,000,000 (one million) bytes. It's not however. One megabyte is 1024 x 1024 bytes.
1024 kilobytes is called one Megabyte. So one kilobyte is actually 1024 bytes, and 1024 of those
is (1024 x 1024) 1048576 bytes. In short, one Megabyte is really 1,048,576 bytes.
There is a difference of about 48 KB, which is a decent amount. If you have a calculator, you
will notice that there is actually a 47KB difference. There is a difference of 48,576 bytes, divided
by 1024, and you get the amount of real kilobytes... 47.4375
All of this really comes into play when you deal with Gigabytes, or roughly one billion bytes.
One real Gigabyte is actually 1024 bytes x 1024 bytes x 1024 bytes...1,073,741,824. However,
most people like to simplify this by simply saying that one Gigabyte is only 1,000,000,000 (one
billion) bytes; which makes sense because the prefix Giga means one billion.
Download