Convert the following decimal number into 8125 singleprecisi

Convert the following decimal number into: -8.125 single-precision floating-point number double-precision floating number

Solution

-8.125

a) single precision floating point number

Single precision floating numbers are of 32 bits which are divided into 3 parts

1 bit-sign bit
8 bits-exponent
23 bits-mantissa

For negative numbers sign bit is 1 and for positive its 1.
For mantissa
the binary equvalent for 8 is 1000
And after decimal there is 125.So keep multiplying .125 by 2 until we get 1 before decimal i.e.
0.125*2=0.25
0.25*2=0.5
0.5*2=1.0
now combine these digits(0001) with the binary equivalent of 8 i.e.
1000.0001
Now move the decimal left upto 3 places i.e. 1.0000001*2^3
Now we have 7 digits after decimal 0000001 and in mantissa we need 23 so we will add 16 0\'s in it.So the mantissa is
   00000010000000000000000

For exponent we need to remember that exponent part of single precision floating number is 127. So, 3+127=130 which is 100000010

So the final conversion is

1 10000010 00000010000000000000000


b) double precision floating poiny number

Double precision floating numbers are of 64 bits which are divided into 3 parts

1 bit-sign bit
11 bits-exponent
52 bits-mantissa

So, by following similar procedure the conversion can be done.

And the final conversion is

1 100000000010 0000010000000000000000000000000000000000000000000000

 Convert the following decimal number into: -8.125 single-precision floating-point number double-precision floating numberSolution-8.125 a) single precision flo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site