Download (DOCX, Unknown)

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Large numbers wikipedia , lookup

Addition wikipedia , lookup

Elementary mathematics wikipedia , lookup

Positional notation wikipedia , lookup

Location arithmetic wikipedia , lookup

Transcript
Representing Data – Real Numbers in Binary
To represent decimals in binary it is usually done in standard form so:
123.456 would be 1.23456 x 10^2
And
0.00167 would be 1.67 x 10^-3
Mantissa is referred to the first part, the number 1.67
Exponent is referred to the second part 10 x^-3
Floating Point
Standard form in binary is Floating Point
In binary the number represent
125
64
32
16
8
4
2
1
In Mantissa they represent
1/2
1/4
1/8
1/16
1/32
1/64
1/128
1/256
1/512
And the exponent is the same as binary but the first number is negative
-4
-16
2
8
1
4
2
1
Example #1
The floating point number uses 10bits for mantissa and the other 6 bits for exponent.
What’s the denary number for:
0100101000 000100
So the mantissa is 0100101000
And the exponent is 000100
First we need to find the exponent
000100
The first number is 0 so the mantissa is going to be positive.
32
0
16
0
8
0
4
1
2
0
1
0
So the denary number for the mantissa is = 4
So it’s 0100101000 *10^4
We move the floating point up 4 spaces
0.100101000 (The floating point starts after the first digit because we assume the number
has been floated into standard form)
And we get
1001.01000
1001 = 9 in denary
.01000
½
0
¼
1
1/8
0
1/16
0
1/32
0
So the final answer is
9.25
Example #2
Convert the floating number to binary.
0101000000 1111110
The first number in the exponent is 1 so it’s a negative number so we use twos complement to
find its denary value.
1111110
-0000010
=
-2
So the exponent is = *10^-2
So we move the floating point 2 places to the left
Making it
0.00101
Which is (1/8) + (1/32) = 0.15625