Floating point representation in binary

advertisement
FLOATING POINT REPRESENTATION IN BINARY
Parts of a Floating point number
Floating point representation in Decimal
Consider an example
123.34
It is represented as
Or
+123.34 x 10+0
+0.123 x 10+3 ………… Example 1
Excess- 50 representations (Exponent)
(Symbolic representation of Decimal number as Binary digit)






Assume our exponent is maximum two digits
So the maximum positive value would be 99 (positive number only)
In Binary number system, Positive and negative numbers represented by “bits”
(Sign bits)
For explanation we are using decimal numbers for Binary representation
Ie Without sign symbol(+.-) we have to utilize digits or numbers for sign
For that we are dividing the total possible quantity that to be represented in two
digit into two parts
00 to 49 and 50 to 99 (for negative as well as positive)
-50 to -01 and 0 to 49. Number above 50 represent positive exponent and number below
50 represents negative exponent
So the Example 1 can be represented as
+0.123 x 10+53
Consider the example:
+.003456 x 10-5
After normalization (eliminating leading zeros) we get
+0.3456 x 10-7
In excess 50 representation we represent as
+0.3456 x 1043
Binary representation
• The mantissa should be normalized
• Has an implied “1” on left of the decimal place
Note that After normalization in binary, the first bit must be 1 and that will not store in register
37.2510 = 100101.012 = 1.0010101 x 25
7.62510 = 111.1012 = 1.11101 x 22
0.312510 = 0.01012 = 1.01 x 2-2
Binary Scientific Notation
 The first, or leftmost, field of our floating point representation will be the sign bit:
0 for a positive number,
1 for a negative number.
 The second field of the floating point number will be the exponent.
Since we must be able to represent both positive and negative exponents, we will use a
convention which uses a value known as a bias of 127 (Excess 127) to determine the
representation of the exponent.
 Excess -127 Representation (Exponent)
As Excess 50 in decimal, binary numbers can represent in Excess 127 format (For
single precession) and excess-1023 ( for double precession )

The mantissa is the set of 0’s and 1’s to the left of the radix point of the normalized
(when the digit to the left of the radix point is 1) binary number.
Ex:1.00101 X 23
The mantissa is stored in a 23 bit field. Ie with 23 bit storage, we can represent 24 bit
mantissa with implied 1 bit on the left of decimal point
Download