(DOCX, Unknown)

advertisement
Binary and Negative binary
Register
To save space in registers binary also uses scientific notation. Normal scientific
notation would be 1.2789331336452x105 whereas scientific notation in binary is to
the base 2.
Example whole number –
5 in a binary form looks like this 101. A 1 at position 1 will be represented by 1*2
(because binary is base 2) to the power 0 as it is in position 1.
This is carried on thought the number as expected so for 101 it would look like
1x22 + 0x21 + 1x20 = 1x22 + 1x20
Example fractions –
0.125 can be represented in binary as the binary fraction 0.001.
Then by looking at the picture it makes the next part easier to understand.
.In binary instead of
going back in 1/10’s it
will be in ½’s because it
is to the base 2.
So to put 0.001 into scientific notation it would look like this.
0x20 + 0x21/2 + 0x21/4 + 1x21/8 = 1x21/8
Using both of these parts real numbers (e.g. 123.123) can now be written in binary.
Real numbers can also be shown in a table format
So you can show the denary number as 43.75
Decimal 32 16 8
4
2
1
. 1/2 1/4 1/8 1/16 1/32 1/64
Binary
1
0
1
0
1
1
. 1
1
0
0
0
0
Negative numbers –
This is the 2’s compliment way of showing negative numbers.
The greatest value is used to represent the negative. This does half the amount of
possible values.
To show -58 in binary it would look like this
-128
64
32
16
8
4
2
1
1
1
0
0
0
1
1
0
Whole numbers –
Representing whole numbers as integers is a very efficient way of doing it. You need
to specify however whether it is signed or not.
E.g.
Define x as unsigned integer
Define x as singed integer
Unsigned integers are assumed to be positive so 10000001 is +129 but if the data is a
'signed integer' then 1000001 is a negative integer -127.
Download