Question

In: Computer Science

Binary and Floating point: Convert −98765.4321 to IEEE 745 both single and double (show your work)

Binary and Floating point:

Convert 98765.4321 to IEEE 745 both single and double (show your work)

Solutions

Expert Solution

Converting 98765.4321 to binary
   Convert decimal part first, then the fractional part
   > First convert 98765 to binary
   Divide 98765 successively by 2 until the quotient is 0
      > 98765/2 = 49382, remainder is 1
      > 49382/2 = 24691, remainder is 0
      > 24691/2 = 12345, remainder is 1
      > 12345/2 = 6172, remainder is 1
      > 6172/2 = 3086, remainder is 0
      > 3086/2 = 1543, remainder is 0
      > 1543/2 = 771, remainder is 1
      > 771/2 = 385, remainder is 1
      > 385/2 = 192, remainder is 1
      > 192/2 = 96, remainder is 0
      > 96/2 = 48, remainder is 0
      > 48/2 = 24, remainder is 0
      > 24/2 = 12, remainder is 0
      > 12/2 = 6, remainder is 0
      > 6/2 = 3, remainder is 0
      > 3/2 = 1, remainder is 1
      > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 11000000111001101
   So, 98765 of decimal is 11000000111001101 in binary
   > Now, Convert 0.43210000000 to binary
      > Multiply 0.43210000000544824 with 2.     Since 0.8642000000108965 is < 1. then add 0 to result
      > Multiply 0.8642000000108965 with 2.  Since 1.728400000021793 is >= 1. then add 1 to result
      > Multiply 0.728400000021793 with 2.   Since 1.456800000043586 is >= 1. then add 1 to result
      > Multiply 0.4568000000435859 with 2.  Since 0.9136000000871718 is < 1. then add 0 to result
      > Multiply 0.9136000000871718 with 2.  Since 1.8272000001743436 is >= 1. then add 1 to result
      > Multiply 0.8272000001743436 with 2.  Since 1.6544000003486872 is >= 1. then add 1 to result
      > Multiply 0.6544000003486872 with 2.  Since 1.3088000006973743 is >= 1. then add 1 to result
      > Multiply 0.30880000069737434 with 2.     Since 0.6176000013947487 is < 1. then add 0 to result
      > Multiply 0.6176000013947487 with 2.  Since 1.2352000027894974 is >= 1. then add 1 to result
      > Multiply 0.23520000278949738 with 2.     Since 0.47040000557899475 is < 1. then add 0 to result
      > Multiply 0.47040000557899475 with 2.     Since 0.9408000111579895 is < 1. then add 0 to result
      > Multiply 0.9408000111579895 with 2.  Since 1.881600022315979 is >= 1. then add 1 to result
      > Multiply 0.881600022315979 with 2.   Since 1.763200044631958 is >= 1. then add 1 to result
      > Multiply 0.763200044631958 with 2.   Since 1.526400089263916 is >= 1. then add 1 to result
      > Multiply 0.526400089263916 with 2.   Since 1.052800178527832 is >= 1. then add 1 to result
      > Multiply 0.05280017852783203 with 2.     Since 0.10560035705566406 is < 1. then add 0 to result
      > Multiply 0.10560035705566406 with 2.     Since 0.21120071411132812 is < 1. then add 0 to result
      > Multiply 0.21120071411132812 with 2.     Since 0.42240142822265625 is < 1. then add 0 to result
      > Multiply 0.42240142822265625 with 2.     Since 0.8448028564453125 is < 1. then add 0 to result
      > Multiply 0.8448028564453125 with 2.  Since 1.689605712890625 is >= 1. then add 1 to result
      > Multiply 0.689605712890625 with 2.   Since 1.37921142578125 is >= 1. then add 1 to result
      > Multiply 0.37921142578125 with 2.    Since 0.7584228515625 is < 1. then add 0 to result
      > Multiply 0.7584228515625 with 2.     Since 1.516845703125 is >= 1. then add 1 to result
      > Multiply 0.516845703125 with 2.  Since 1.03369140625 is >= 1. then add 1 to result
      > Multiply 0.03369140625 with 2.   Since 0.0673828125 is < 1. then add 0 to result
      > Multiply 0.0673828125 with 2.    Since 0.134765625 is < 1. then add 0 to result
      > Multiply 0.134765625 with 2.     Since 0.26953125 is < 1. then add 0 to result
      > Multiply 0.26953125 with 2.  Since 0.5390625 is < 1. then add 0 to result
      > Multiply 0.5390625 with 2.   Since 1.078125 is >= 1. then add 1 to result
      > Multiply 0.078125 with 2.    Since 0.15625 is < 1. then add 0 to result
      > Multiply 0.15625 with 2.     Since 0.3125 is < 1. then add 0 to result
      > Multiply 0.3125 with 2.  Since 0.625 is < 1. then add 0 to result
      > Multiply 0.625 with 2.   Since 1.25 is >= 1. then add 1 to result
      > Multiply 0.25 with 2.    Since 0.5 is < 1. then add 0 to result
      > Multiply 0.5 with 2.     Since 1.0 is >= 1. then add 1 to result
      > This is equal to 1, so, stop calculating
   0.43210000000544824 of decimal is .01101110100111100001101100001000101 in binary
   so, 98765.4321 in binary is 11000000111001101.01101110100111100001101100001000101
-98765.4321 in simple binary => 11000000111001101.01101110100111100001101100001000101
so, -98765.4321 in normal binary is 11000000111001101.01101110100111100001101100001000101
=>   1.100000011100110101101110100111100001101100001000101 * 2^16
1.10000001110011010110111 * 2^16

single precision:
--------------------
sign bit is 1(-ve)
exp bits are (127+16=143) => 10001111
   Divide 143 successively by 2 until the quotient is 0
      > 143/2 = 71, remainder is 1
      > 71/2 = 35, remainder is 1
      > 35/2 = 17, remainder is 1
      > 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 10001111
   So, 143 of decimal is 10001111 in binary
frac bits are 10000001110011010110111

so, -98765.4321 in single-precision format is 1 10001111 10000001110011010110111
in hexadecimal it is 0xC7C0E6B7

double precision:
--------------------
sign bit is 1(-ve)
exp bits are (1023+16=‭1039‬) => 10000001111
        Divide 1039 successively by 2 until the quotient is 0
        > 1039/2 = 519, remainder is 1
        > 519/2 = 259, remainder is 1
        > 259/2 = 129, remainder is 1
        > 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 10000001111
    So, 1039 of decimal is 10000001111 in binary
frac bits are 1000000111001101011011101001111000011011000010001010

so, -98765.4321 in double-precision format is 1 10000001111 1000000111001101011011101001111000011011000010001010

Related Solutions

Binary conversion: Convert 1234.5869 × 103 to IEEE 745 (show your work)
Binary conversion: Convert 1234.5869 × 103 to IEEE 745 (show your work)
Convert −98765.4321 to IEEE 745 (show your work)
Convert −98765.4321 to IEEE 745 (show your work)
Binary math: Convert 0xc996b4d7 from IEEE 745 to scientific notation (X * 10Y) (show your work)
Binary math: Convert 0xc996b4d7 from IEEE 745 to scientific notation (X * 10Y) (show your work)
Convert 1101.11011101 x 223 to IEEE Standard 754 for single-precision floating-point binary format. Convert the IEEE...
Convert 1101.11011101 x 223 to IEEE Standard 754 for single-precision floating-point binary format. Convert the IEEE Standard 754 number 11001010100011010101000000000000 to its decimal equivalent.
Q1.Convert C46C000016 into a 32-bit single-precision IEEE floating-point binary number.
Q1.Convert C46C000016 into a 32-bit single-precision IEEE floating-point binary number.
Convert the following floating-point number (stored using IEEE floating-point standard 754) to a binary number in...
Convert the following floating-point number (stored using IEEE floating-point standard 754) to a binary number in non-standard form. 0100_0001_1110_0010_1000_0000_0000_0000
A) Convert 1101.11011101 x 223 to IEEE Standard 754 for single precision floating-point binary format. B)...
A) Convert 1101.11011101 x 223 to IEEE Standard 754 for single precision floating-point binary format. B) Convert the IEEE Standard 754 number 11001010100011010101000000000000 to its decimal equivalent.  
Convert 0.875 to an IEEE 754 single-precision floating-point number. Show the sign bit, the exponent, and...
Convert 0.875 to an IEEE 754 single-precision floating-point number. Show the sign bit, the exponent, and the fraction. Convert -3.875 to an IEEE 754 double-precision floating-point number. Show the sign bit, the exponent, and the fraction Convert the IEEE 754 single-precision floating-point numbers 42E4800016 and 0080000016 to their corresponding decimal numbers.
Convert the following binary floating point  to decimal IEEE 32-bit floating point format.   0 1000 0101 000...
Convert the following binary floating point  to decimal IEEE 32-bit floating point format.   0 1000 0101 000 0100 1101 0000 0000 0000
Convert 0xCD001234 from IEEE-754 hexadecimal to single-precision floating point format. Please show every single detail for...
Convert 0xCD001234 from IEEE-754 hexadecimal to single-precision floating point format. Please show every single detail for upvote. Please do not answer otherwise.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT