Answer to Question #144661 in Assembler for Promise Omiponle

Question #144661
For the two IEEE-754 single-precision floating-point numbers P = 0xC1300000 and
Q = 0x3D600000, perform the following operations in binary floating point, and give
the IEEE-754 single-precision floating-point format results in both binary and
hexadecimal representations. (Do not convert P and Q to decimal, perform the
operations in decimal, and convert the results to IEEE-754 single precision.)
a. P x Q
b. P + Q
1
Expert's answer
2020-11-22T23:44:13-0500

P = 0xC1300000     binary:    1100 0001 0011 0000 0000 0000 0000 0000

Q = 0x3D600000    binary:    0011 1101 0110 0000 0000 0000 0000 0000

 

The general representation formula is:

(-1)^s * (1+mantissa) * 2^(Exponent – 127)

Conversion:

The value of a IEEE-754 number is computed as:

The sign is stored in bit 32. The exponent can be computed from bits 24-31 by subtracting 127. The mantissa (also known as significand or fraction) is stored in bits 1-23. An invisible leading bit (i.e. it is not actually stored) with value 1.0 is placed in front, then bit 23 has a value of 1/2, bit 22 has value 1/4 etc. As a result, the mantissa has a value between 1.0 and 2

 

P Sign

   bit        Exponent                   Mantissa

    1       10000010    01100000000000000000000

 (-1)^1        2^3                     1 + 1/4 + 1/8

-1 * 8 * 1.375 = -11

 

Q Sign

   bit         Exponent                   Mantissa

     1       10000010     11000000000000000000000

 (-1)^0        2^(-5)                     1 + 1/2 + 1/4

1 * 0.03125 * 1.75 = 0.0546875

 

 

P*Q

P    - 1.01100000000000000000000 *2^3 
Q    + 1.11000000000000000000000 *2^(-5) 
-----------------------------------------------------------------------

P*Q - 10.01101000000000000000000|000 *2-2

 
P*Q    - 1.00110100000000000000000|00 *2^(-1)

(1 + 1/8 + 1/16 + 1/64) * 2-1 = -0.6015625

P*Q    - 1.00110100000000000000000 *2^(-1) = -0.6015625

Sign bit      Exponent                   Mantissa

     1            01111110     00110100000000000000000
 

ANSWER:

P*Q =

BIN:    1011 1111 0001 1010 0000 0000 0000 0000

HEX:  0xbf1a0000

 

P+Q

Alignment:

P       - 1.01100000000000000000000|000 *2^3
Q       + 0.00000001110000000000000|000 *2^3
----------------------------------------------------------------------------------
P+Q   - 1.01011110010000000000000|000 *2^3
-1*(1 + 1/4 + 1/16 + 1/32 + 1.64 + 1/128 + 1/1024)* 2^3 = -10.9453125
P+Q=    - 1.01011110010000000000000 *2^3 = -10.9453125

Sign bit   Exponent                   Mantissa

 1             10000010      01011110010000000000000

 

ANSWER:

P+Q =

BIN:   1100 0001 0010 1111 0010 0000 0000 0000
HEX:0xc12f2000

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS