Question

In: Computer Science

Represent the following decimal numbers using IEEE-754 floating point representation. A. -0.375 B. -Infinity C. 17...

Represent the following decimal numbers using IEEE-754 floating point representation.

A. -0.375

B. -Infinity

C. 17

D. 5.25

Solutions

Expert Solution

a) -0.375
-0.375
Converting 0.375 to binary
   Convert decimal part first, then the fractional part
   > First convert 0 to binary
   Divide 0 successively by 2 until the quotient is 0
   Read remainders from the bottom to top as
   So, 0 of decimal is  in binary
   > Now, Convert 0.37500000 to binary
      > Multiply 0.37500000 with 2.  Since 0.75000000 is < 1. then add 0 to result
      > Multiply 0.75000000 with 2.  Since 1.50000000 is >= 1. then add 1 to result
      > Multiply 0.50000000 with 2.  Since 1.00000000 is >= 1. then add 1 to result
      > This is equal to 1, so, stop calculating
   0.375 of decimal is .011 in binary
   so, 0.375 in binary is 00000000.011
-0.375 in simple binary => .011
so, -0.375 in normal binary is .011 => 1.1 * 2^-2

single precision:
--------------------
sign bit is 1(-ve)
exponent bits are (127-2=125) => 01111101
   Divide 125 successively by 2 until the quotient is 0
      > 125/2 = 62, remainder is 1
      > 62/2 = 31, remainder is 0
      > 31/2 = 15, remainder is 1
      > 15/2 = 7, remainder is 1
      > 7/2 = 3, remainder is 1
      > 3/2 = 1, remainder is 1
      > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 1111101
   So, 125 of decimal is 1111101 in binary
frac/significant bits are 10000000000000000000000

so, -0.375 in single-precision format is 1 01111101 10000000000000000000000
in hexadecimal it is 0xBEC00000
Answer: 1 01111101 10000000000000000000000

b) -Infinity
Sign bit = 1
exponent bits = 11111111
mantissa bits = 00000000000000000000000
Answer: 1 11111111 00000000000000000000000

c) 17
17
Converting 17.0 to binary
   Convert decimal part first, then the fractional part
   > First convert 17 to binary
   Divide 17 successively by 2 until the quotient is 0
      > 17/2 = 8, remainder is 1
      > 8/2 = 4, remainder is 0
      > 4/2 = 2, remainder is 0
      > 2/2 = 1, remainder is 0
      > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10001
   So, 17 of decimal is 10001 in binary
   > Now, Convert 0.00000000 to binary
      > Multiply 0.00000000 with 2.  Since 0.00000000 is < 1. then add 0 to result
      > This is equal to 1, so, stop calculating
   0.0 of decimal is .0 in binary
   so, 17.0 in binary is 00010001.0
17.0 in simple binary => 10001.0
so, 17.0 in normal binary is 10001.0 => 1.0001 * 2^4

single precision:
--------------------
sign bit is 0(+ve)
exponent bits are (127+4=131) => 10000011
   Divide 131 successively by 2 until the quotient is 0
      > 131/2 = 65, remainder is 1
      > 65/2 = 32, remainder is 1
      > 32/2 = 16, remainder is 0
      > 16/2 = 8, remainder is 0
      > 8/2 = 4, remainder is 0
      > 4/2 = 2, remainder is 0
      > 2/2 = 1, remainder is 0
      > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10000011
   So, 131 of decimal is 10000011 in binary
frac/significant bits are 00010000000000000000000

so, 17.0 in single-precision format is 0 10000011 00010000000000000000000
in hexadecimal it is 0x41880000
Answer: 0 10000011 00010000000000000000000

d) 5.25
5.25
Converting 5.25 to binary
   Convert decimal part first, then the fractional part
   > First convert 5 to binary
   Divide 5 successively by 2 until the quotient is 0
      > 5/2 = 2, remainder is 1
      > 2/2 = 1, remainder is 0
      > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 101
   So, 5 of decimal is 101 in binary
   > Now, Convert 0.25000000 to binary
      > Multiply 0.25000000 with 2.  Since 0.50000000 is < 1. then add 0 to result
      > Multiply 0.50000000 with 2.  Since 1.00000000 is >= 1. then add 1 to result
      > This is equal to 1, so, stop calculating
   0.25 of decimal is .01 in binary
   so, 5.25 in binary is 00000101.01
5.25 in simple binary => 101.01
so, 5.25 in normal binary is 101.01 => 1.0101 * 2^2

single precision:
--------------------
sign bit is 0(+ve)
exponent bits are (127+2=129) => 10000001
   Divide 129 successively by 2 until the quotient is 0
      > 129/2 = 64, remainder is 1
      > 64/2 = 32, remainder is 0
      > 32/2 = 16, remainder is 0
      > 16/2 = 8, remainder is 0
      > 8/2 = 4, remainder is 0
      > 4/2 = 2, remainder is 0
      > 2/2 = 1, remainder is 0
      > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10000001
   So, 129 of decimal is 10000001 in binary
frac/significant bits are 01010000000000000000000

so, 5.25 in single-precision format is 0 10000001 01010000000000000000000
in hexadecimal it is 0x40A80000
Answer: 0 10000001 01010000000000000000000



Related Solutions

Using IEEE 754 single precision floating point, write the hexadecimal representation for each of the following:...
Using IEEE 754 single precision floating point, write the hexadecimal representation for each of the following: a. Zero b. -2.0 (base 10) c. 256. 0078125 (base 10) d. Negative infinity
For IEEE 754 single-precision floating point, what is the hexadecimal representation of 27.101562? A. 35CCD001 B....
For IEEE 754 single-precision floating point, what is the hexadecimal representation of 27.101562? A. 35CCD001 B. 2F5C10D0 C. 41D8D000 D. 7DCA1111 E. None of the above
Determine the IEEE single and double floating point representation of the following numbers: a) -26.25 b)...
Determine the IEEE single and double floating point representation of the following numbers: a) -26.25 b) 15/2
Describe how zero, infinity, and NaN are stored in IEEE 754 floating point formats
Describe how zero, infinity, and NaN are stored in IEEE 754 floating point formats
Express the following two base 10 numbers in binary using the IEEE 754 single-precision floating point...
Express the following two base 10 numbers in binary using the IEEE 754 single-precision floating point format (i.e., 32 bits). Express your final answer in hexadecimal (e.g., 32’h????????). a) 68.3125 b) -19.675
Determine the IEEE single and double floating point representation of the following numbers: a) (15/2) x...
Determine the IEEE single and double floating point representation of the following numbers: a) (15/2) x 2^50 b) - (15/2) x 2^-50 c) 1/5
verilog code to implement 32 bit Floating Point Adder in Verilog using IEEE 754 floating point...
verilog code to implement 32 bit Floating Point Adder in Verilog using IEEE 754 floating point representation.
Consider the following 32-bit floating point representation based on the IEEE floating point standard: There is...
Consider the following 32-bit floating point representation based on the IEEE floating point standard: There is a sign bit in the most significant bit. The next eight bits are the exponent, and the exponent bias is 28-1-1 = 127. The last 23 bits are the fraction bits. The representation encodes number of the form V = (-1)S x M x 2E, where S is the sign, M is the significand, and E is the biased exponent. The rules for the...
The number –11.375 (decimal) represented as a 32-bit floating-point binary number according to the IEEE 754...
The number –11.375 (decimal) represented as a 32-bit floating-point binary number according to the IEEE 754 standard is
Given the following 32-bit binary sequences representing single precision IEEE 754 floating point numbers: a =...
Given the following 32-bit binary sequences representing single precision IEEE 754 floating point numbers: a = 0100 0000 1101 1000 0000 0000 0000 0000 b = 1011 1110 1110 0000 0000 0000 0000 0000 Perform the following arithmetic and show the results in both normalized binary format and IEEE 754 single-precision format. Show your steps. a)     a + b b)     a × b
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT