-1

Using....

sign bit of mantissa 8 bit exponent in two's complement 23 bit mantissa

code the following: -28.625

Can someone show me the easiest way to do this...lecturer wasn't very helpful!

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Cian Woods
  • 45
  • 2
  • 10

2 Answers2

1

There is a useful online calculator here. It shows that -28.625 (-1.7890625 * 2^4) is:

1 10000011 11001010000000000000000
s eeeeeeee mmmmmmmmmmmmmmmmmmmmmmm
=     =
1    131
      =
   127 + 4

or:

0xc1e50000

Note that there is an implicit 1 bit at the start of the mantissa.

Paul R
  • 208,748
  • 37
  • 389
  • 560
1

If the number is negative, then the first bit is representated as 1. Next convert the whole number part and fraction part into binary values. Move the radix next to the left most 1 bit, and count how many places it moved, this is your n, and all the bits to the right will go to mantissa. As for the exponent, it is bias (2^n-1) + n, so in this case bias is 2^8-1 = 127, and add n to this, convert this to binary. The rest of the bit places are for mantissa. I believe the answer is 11000001111001010000000000000000

user3227275
  • 286
  • 1
  • 8