PDA

View Full Version : 8-bits mantissa and 5 bits exponent

solomon_13000
04-24-2007, 11:31 AM
I did a floating point addition using 8-bits mantissa and 5 bits exponent. The answer I obtain for:

1) 4.5 + 5.0

01001100 , 00100

2) -12.25 - 10.5

10100101, 00001

3) 7.25 - 14.0

00001101, 00001

4) 0.5 + 0.375

00110000, 00001

5) 0.2 + 0.0625

00001100, 00001

Is my solution above correct.

tkhunny
04-24-2007, 02:18 PM
Well, that would seem to depend on what it is you are doing. Since you didn't really tell us anything, it's pretty hard to make a judgment.

Are you just catenating? Are you adding? Is it an XOR thing?

As a good general rule, the ENTIRE problem statement is the most useful deliverable.

solomon_13000
04-24-2007, 02:40 PM
what basically I did is to convert the numbers into 8-bits mantissa and 5 bits exponent. Then I did an arithmatic shift from left to right.

1) 4.5 + 5.0

8-bits mantissa (01001100)

5 bits exponent (00100)

daon
04-24-2007, 02:57 PM
I did a floating point addition using 8-bits mantissa and 5 bits exponent. The answer I obtain for:

1) 4.5 + 5.0

01001100 , 00100

If I remember from semesters ago... Your exponent bias adapted to 5-bit should be 15 (available bits range from -16 to 15 as opposed to -128 to 127 for 8-bit).

Since 9.5 = 1.0011 * 2^3 your exponent is 3, so your biased exponent is 3+15=18 or in binary: 10010. Your significand/mantissa is 00110000.

Your binary representation looks like 0-10010-00110000. It is a bit odd using the given precision.