Hi. I want to present number -6.25 as a floating point number ( 32 bit presentation )
My solution is ( because number is negative; first 1 bits and then .25 )
1111 1111 1111 1111 0000 0110 0001 1001
4 2 16 8 1
---- -----------
6 25
Is this the right way?
question about floating point number
Started by mike221, Nov 11 2008 06:59 AM
9 replies to this topic
#1
Posted 11 November 2008 - 06:59 AM
|
|
|
#2
Posted 11 November 2008 - 08:18 AM
It depends on what specification you are trying to conform to (IEEE?).
#3
Posted 12 November 2008 - 02:36 AM
Hi. Yes; IEEE. I think my solution is right, but I am not 100 % sure.
#5
Posted 13 November 2008 - 10:41 AM
I give up, too difficult...Oh my god, can someone please ( ??? ) tell what would be right;
-8.35
and my solution was
1111 1111 1111 1111 0000 0110 0001 1001
but exponents are wrong. IEEE
-8.35
and my solution was
1111 1111 1111 1111 0000 0110 0001 1001
but exponents are wrong. IEEE
#6
Posted 13 November 2008 - 11:11 AM
Let's break this up:
You have:
-8.35 = - (100.010101000...)
sign: 1 --> negative
exponent: 111 1111 1 --> exponent of 128!
fraction: 111 1111 0000 0110 0001 1001 --> binary base value of 1.111 1111 0000 0110 0001 1001.
Thus, my assertion that your result is incorrect.
You have:
-8.35 = - (100.010101000...)
sign: 1 --> negative
exponent: 111 1111 1 --> exponent of 128!
fraction: 111 1111 0000 0110 0001 1001 --> binary base value of 1.111 1111 0000 0110 0001 1001.
Thus, my assertion that your result is incorrect.
#7
Posted 14 November 2008 - 02:16 AM
THANKS!
Yeah, I changed the negative number to -8.35 and so that is;
binary base value of 1.111 1111 0000 0110 0001 1001 and in so 32 bit it is;
1111 1111 1.111 1111 0000 0110 0001 1001
Yeah, I changed the negative number to -8.35 and so that is;
binary base value of 1.111 1111 0000 0110 0001 1001 and in so 32 bit it is;
1111 1111 1.111 1111 0000 0110 0001 1001
#8
Posted 14 November 2008 - 07:34 AM
My point is, your exponent should NOT be 128! It's actually 2.
#9
Posted 14 November 2008 - 09:18 AM
Ah, so -8.35 is;
0000 0010 1.111 1111 0000 0110 0001 1001.
now exponent isn't 128. But it is 2. Still right?...
0000 0010 1.111 1111 0000 0110 0001 1001.
now exponent isn't 128. But it is 2. Still right?...
#10
Posted 14 November 2008 - 11:07 AM
You have several bits you have to combine:
(x) - sign bit
(xxxx xxxx) - exponent bits with 127 added to the value represented
(xxxx xxxx xxxx xxxx xxxx xxx) - digits after the decimal point after you have shifted the digits so only the lead 1 is to the left of the decimal point
- means the sign bit is 1
exponent 2 means you have to encode 129 for the exponent bits
for the fraction, convert 8.35 to binary, and copy all the bits EXCEPT the leading 1!
(x) - sign bit
(xxxx xxxx) - exponent bits with 127 added to the value represented
(xxxx xxxx xxxx xxxx xxxx xxx) - digits after the decimal point after you have shifted the digits so only the lead 1 is to the left of the decimal point
- means the sign bit is 1
exponent 2 means you have to encode 129 for the exponent bits
for the fraction, convert 8.35 to binary, and copy all the bits EXCEPT the leading 1!


Sign In
Create Account


Back to top









