Page 1 of 1

Reputation:

# decimal to floating point

Posted 26 April 2010 - 12:38 PM

convert 3.4375(decimal) to an 8-bit floating point binarty patter that uses 1 bit for the sign, 3 bits for the exponent(excess-4 notation), and 4 bits of rthe manitssa.

for number 3 what I did so far is the mutliplication of the decimal point by 2( ex. 0.4375 x 2=0.875, 0.875x 2= 1.75 .....). So 0.4375=.0111 and 3.4375= 011.0111, now I am stuck now with normalizing the number and so forth. what I understand about normalzing is that the dot has to be 1 bit from the left, but if I do this I get 0.110111.

Is This A Good Question/Topic? 0

## Replies To: decimal to floating point

### #2 modi123_1

• Suitor #2

Reputation: 13768
• Posts: 54,954
• Joined: 12-June 08

## Re: decimal to floating point

Posted 27 April 2010 - 07:18 AM

brock, on 26 April 2010 - 01:38 PM, said:

convert 3.4375(decimal) to an 8-bit floating point binarty patter that uses 1 bit for the sign, 3 bits for the exponent(excess-4 notation), and 4 bits of rthe manitssa.

for number 3 what I did so far is the mutliplication of the decimal point by 2( ex. 0.4375 x 2=0.875, 0.875x 2= 1.75 .....). So 0.4375=.0111 and 3.4375= 011.0111, now I am stuck now with normalizing the number and so forth. what I understand about normalzing is that the dot has to be 1 bit from the left, but if I do this I get 0.110111.

I vote reject answer! Oh.. wait.. I can't vote? What sort of constitution are we operating under?!

Reputation:

## Re: decimal to floating point

Posted 27 April 2010 - 04:43 PM

### #4 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,429
• Joined: 27-December 05

## Re: decimal to floating point

Posted 27 April 2010 - 08:53 PM

brock, on 26 April 2010 - 03:38 PM, said:

what I did so far is the mutliplication of the decimal point by 2( ex. 0.4375 x 2=0.875, 0.875x 2= 1.75 .....). So 0.4375=.0111 and 3.4375= 011.0111, now I am stuck now with normalizing the number and so forth. what I understand about normalzing is that the dot has to be 1 bit from the left, but if I do this I get 0.110111.

Your "result" (so far) is correct but for the wrong reason. Decimal 3.4375 converted to binary is 11.0111 (forget about any leading 0). Normalizing it involves moving the radix point to the left of the first non-zero digit. How far you move it determines the exponent. Which direction you move it determines the sign of the exponent.

Now you continue ...

Reputation:

## Re: decimal to floating point

Posted 27 April 2010 - 09:51 PM

So 11.0111 turns into .110111 . Now the radix was moved two times which in excess notation is 110. So the sign bit is 0 the exponent is 110 and the mantissa is 1101, so all together it is 0 110 1101. But the asnwer is 0 110 1110

### #6 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,429
• Joined: 27-December 05

## Re: decimal to floating point

Posted 27 April 2010 - 10:42 PM

Looks like whoever wrote that "answer" got it wrong. Either they have the mantissa before the exponent instead of after, or they screwed up in calculating the mantissa.

...or maybe not. See post below.

This post has been edited by r.stiltskin: 28 April 2010 - 02:06 PM

Reputation:

## Re: decimal to floating point

Posted 28 April 2010 - 09:28 AM

so is 0 110 1101 correct then because 0 110 1110 is the answer my prof gave us.

### #8 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,429
• Joined: 27-December 05

## Re: decimal to floating point

Posted 28 April 2010 - 10:46 AM

I'm not just being facetious. I think I see what's happening. First of all recognize that this algorithm isn't what is generally used to represent floating point numbers on real, modern computers. In most cases they follow the IEEE754 standard -- you can google that for details. What you're using is a simplified algorithm for teaching purposes, and different versions are used at different schools. In the ones that I've seen before today, any "extra" digits in the mantissa are simply truncated, so .110111 becomes .1101 if only 4 digits can be used. But rounding, rather than truncating the extra digits is also a valid approach and arguably more accurate than truncating. So, since .110111 is closer to .1110 than it is to .1101, it seems that your professor is rounding rather than truncating the result and under that assumption .1110 is correct for the mantissa, and 01101110 is correct for the entire number.

Reputation:

## Re: decimal to floating point

Posted 28 April 2010 - 02:05 PM

is this because .110111 equals 55/64 and .1110 = 52/64 and .1101 = 50/64.

### #10 r.stiltskin

• D.I.C Lover

Reputation: 2030
• Posts: 5,429
• Joined: 27-December 05

## Re: decimal to floating point

Posted 28 April 2010 - 02:31 PM

brock, on 28 April 2010 - 05:05 PM, said:

is this because .110111 equals 55/64 and .1110 = 52/64 and .1101 = 50/64.

You have a couple of mistakes there. But an easier way to see it is:

0.110111
+.000001
0.111000

0.110111
-.000011
0.110100

So rounding up means adding only 0.000001 (1/64) whereas truncating means subtracting 0.000011 (3/64).