0% found this document useful (0 votes)
123 views3 pages

Decimal To Floating Point: Property of STI

1) Convert -12.0 to 8-bit floating point format. The sign bit is 1, the exponent is 110 (6 in binary), and the mantissa is 1000. 2) Convert 31.375 to IEEE 32-bit floating point format. The sign bit is 0, the exponent is 10000011 (131 in binary), and the mantissa is 11111.0112.

Uploaded by

jj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views3 pages

Decimal To Floating Point: Property of STI

1) Convert -12.0 to 8-bit floating point format. The sign bit is 1, the exponent is 110 (6 in binary), and the mantissa is 1000. 2) Convert 31.375 to IEEE 32-bit floating point format. The sign bit is 0, the exponent is 10000011 (131 in binary), and the mantissa is 11111.0112.

Uploaded by

jj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

IT1903

Decimal to Floating Point

1. Convert -12.0 to 8-bit floating point format.

Solution:
1. Observe the Sign: For -12.0 the sign is negative. For 12:
This means that the first bit will be 1, if positive Calculation Quotient Remainder
the first bit will be 0. 12/2 6 0
6/2 3 0
2. From Decimal to Binary: Convert decimal 3/2 1 1
number to binary scientific notation, processing 1/2 Cannot be 1
the integral and fractional part independently.
Converting the fractional part to binary: To
The integral part is the number in front of the convert the fractional part to the binary system,
decimal point (-12), the fractional part is the rest multiply the number repeatedly by 2, keeping
after the decimal point (.0). Hence, track of each integer part of the results, until the
acquired fractional part is equal to zero.
Converting the integral part to binary: To
convert the integral part to the binary system, For 0:
divide the number repeatedly by 2, keeping track Product
of each remainder, until a quotient acquired is Integer Fractional
equal to 0. Part Part
Step 1 0.0 * 2 = 0 . 0

Thus, 12 = 11002 and .0 = 02 = 1100.02


0
3. Append × 2 to the end of the binary number 4. Normalize the binary representation of the
(which does not change its value). number, shifting the decimal point to the left
most position so that only one non zero digit
Thus, the integral and fractional parts of the remains to the left of it.
number -12.0 combined gives the scientific
binary number 1100.02*20. For the number 1100.02*20, the decimal point
can be moved 4 positions to the left, which
increases
the exponent by 1.1000*23.
5. Add the bias to the exponent of two, and Thus, exponent (adjusted) = 3 + 3 = 6
place it in the exponent field. The bias is 2k−1
− 1, where k is the number of bits in the For 6:
exponent field. For the eight-bit format, k = Calculation Quotient Remainder
3, so the bias is 23−1 − 1 = 3. For IEEE 32- 6/2 3 0
bit, k = 8, so the bias is 28−1 − 1 = 127. 3/2 1 1
Convert it from decimal (base 10) to 8 bit 1/2 Cannot be 1
binary, by using the same technique of
repeatedly dividing by 2. 6 = 110 in binary.
6. Place the mantissa into the mantissa field of 7. Combine sign, exponent, and significant.
the number. Omit the leading one, and
adjust its length by filling necessary number The format is:
Sign Exponent Mantissa
of zeros to the right.
1 110 1000
= E816
1.1000*23

Mantissa = 1000

04 Handout *Property of
STI
IT1903

2. Convert 31.375 to IEEE 32-bit floating point format.

1. Observe the Sign: For 31.375 the sign is For 31:


positive. This means that the first bit will be Calculation Quotient Remainder
0, if negative the first bit will be 1. 31/2 15 1
15/2 7 1
2. From Decimal to Binary: Convert decimal 7/2 3 1
number to binary scientific notation, 3/2 1 1
processing the integral and fractional part 1/2 Cannot be 1
independently.
Converting the fractional part to binary: To
The integral part is the number in front of convert the fractional part to the binary system,
the decimal point (31), the fractional part is multiply the number repeatedly by 2, keeping
the rest after the decimal point (.375). track of each integer part of the results, until the
Hence, acquired fractional part is equal to zero.

Converting the integral part to binary: To For 375:


convert the integral part to the binary Product
system, divide the number repeatedly by 2, Integer Fractional
keeping track of each remainder, until a Part Part
quotient acquired is equal to 0. Step 1 0.375 * 2 = 0 . 75

Step 2 0.75 * 2 = 1 . 5

0.5 * 2 = 1 . 0

Thus, 31 = 111112 and .375 = 0112 = 11111.0112


0
3. Append × 2 to the end of the binary number 4. Normalize the binary representation of the
(which does not change its value). number, shifting the decimal point to the left
most position so that only one non zero digit
Thus, the integral and fractional parts of the remains to the left of it.
number 31.375 combined gives the scientific
binary number 11111.0112*20. For the number 11111.0112*20, the decimal point
can be moved 4 positions to the left, which
increases the exponent by 1.1111011*2 4.
5. Add the bias to the exponent of two, and
place it in the exponent field. The bias is 2k−1 Thus, exponent (adjusted) = 4 + 127 = 131
− 1, where k is the number of bits in the
exponent field. For the eight-bit format, k = For 131:
3, so the bias is 23−1 − 1 = 3. For IEEE 32- Calculation Quotient Remainder
bit, k = 8, so the bias is 28−1 − 1 = 127. 131/2 65 1
Convert it from decimal (base 10) to 8 bit 65/2 32 1
binary, by using the same technique of 32/2 16 0
repeatedly dividing by 2. 16/2 8 0
8/2 4 0
4/2 2 0
2/2 1 0
1/2 Cannot be 1

131 = 10000011 in binary.

04 Handout *Property of
STI
IT1903

6. Place the mantissa into the mantissa field of the number. Omit the leading
7. Combine sign, one, and adjust
exponent, its length to 23 bits, by fillin
and significant.

1.1111011*24 The format is:


Sign Exponent Mantissa
Mantissa = 11110110000000000000000 0 1000 11110110000000000000000
0011

= 41FB000016

Float to Decimal Conversion

1. Convert the 8-bit floating point number e7 (in hex) to decimal.

Solution:
1. Convert: 𝑒716 = 111001112. 2. Separate:
1 110 0111
3. Mantissa: 1.0111 4. Exponent: 1102 = 610; 6 − 3 = 3.
5. De-normalize: 1.01112 × 23 = 1011.1 6. Convert:
Exponents 23 22 21 20 2−1
Place
8 4 2 1 0.5
Values
Bits 1 0 1 1. 1
Value 8 +2 +1 +0.5 =11.5
7. Sign: negative. Answer: e7 is -11.5

2. Convert the 32-bit floating point number 44361000 (in hex) to decimal.

Solution:
1. Convert: 2. Separate:
4436100016 = 0 10001000 01101100001000000000000
010001000011011000010000000000002.
3. Exponent:
100010002 = 13610; 136 − 127 = 9.
4. De-normalize:
1.011011000012 × 29 = 1011011000.01
5. Convert:
Exponents 29 28 27 26 25 24 23 22 21 20 2−1 2−2
Place
512 256 128 64 32 16 8 4 2 1 0.5 0.25
Values
Bits 1 0 1 1 0 1 1 0 0 0. 0 1
Value 512 +128 +64 +16 +8 +0.27 =728.25
6. Sign: positive Answer: 44361000 is 728.25

04 Handout *Property of
STI

You might also like