Convert the following into single-precision IEEE floating point. Fill in the S,
ID: 3709166 • Letter: C
Question
Convert the following into single-precision IEEE floating point. Fill in the S, E, and F fields in binary (using the correct number of bits), and then convert the entire 32-bit binary string to hexadecimal (simply by grouping 4 bits at a time).
a) 130.0
S field: __________ (0 or 1)
E field (binary): __________ (must have exactly 8 bits)
F field (binary): __________ (must have exactly 23 bits)
Complete Number (hex): 0x__________ (must have 8 hexits; do not write 0x in blank)
b) -126.0
S field: __________ (0 or 1)
E field (binary): __________ (must have exactly 8 bits)
F field (binary): __________ (must have exactly 23 bits)
Complete Number (hex): 0x__________ (must have 8 hexits; do not write 0x in blank)
c) 0x33330000
Convert the following single-precision floating-point number given in hexadecimal to decimal. Determine the S, E, and F fields, then compute the decimal value using a calculator.
Tip: For the F field, remember that, except for special cases, the "1." is dropped from the significand; only the bits after the binary point are included.?
S field: __________ (0 or 1)
E field (binary): __________ (must have exactly 8 bits)
F field (binary): __________ (must have exactly 23 bits)
Decimal (using calculator): __________*10^__________ [Note: Use normalized scientific notation with 2 decimal places, e.g., 1.23*10^-5]
Explanation / Answer
a. 130.0 in binary form is
10000010.0
Sign bit: 0, as it is a positive number
Exponent bits:
First the above binary number should be represented in normalised form as
1.0000010*27
Since it's a single precision floating point number, bias is 127. Therefore exponent is 7+127=134
In binary it is 10000110
Exponent bits: 10000110
Fraction bits: normalised fraction part in binary form
F bits: 0000010
Therefore the 32bit binary number is
0-100 0011 0-000 0010 0000 0000 0000 0000
In Hexadecimal: 4302000
b. -126.0 in binary form is
1111110.0
Sign bit: 1, as it is a negative number
Exponent bits:
First the above binary number should be represented in normalised form as
1.111110*26
Since it's a single precision floating point number, bias is 127. Therefore exponent is 6+127=133
In binary it is 10000101
Exponent bits: 10000101
Fraction bits: normalised fraction part in binary form
F bits: 111110
Therefore the 32bit binary number is
1-100 0010 1-111 1100 0000 0000 0000 0000
In Hexadecimal: c2fc0000
c. 0x33330000 in hexagon decimal is represented in binary as
0-011 0011 0-011 0011 0000 0000 0000 0000
Sign field, S: 0, so the number is a positive number
Exponent field, E: 011 00110, it is 102 in normalised form
Actual exponent is: 102-127=-25
Fraction field, F: 01100110000000000000000
To convert the fraction field to decimal, 1*2-2+1*2-3+1*2-6+1*2-7= 0.3984375*2-25
= 1.18*10-8