+Alpha Yeti The last 1 of the sequence 0011 goes outside of the bounds of the significand, so the number has to be rounded up. This causes the result above, and also explains why floating point numbers cannot precisely represent certain values.
This is nice and all, but what if X_E + Y_E > 255, that is to say, what if the new exponent is to large to be represented in 8 bits? Do we just cap it at 255 since this is the best we can do?
thats a special case. if the exponent is too large to be displayed in 8 bits the result of that multiplication will be + or - infinity (depending on the sign bit). Usually a Full Adder or Carry-Look-Ahead Adder or whatever you use to multiply numbers has a mechanism that detects whether there is an overflow happening (in the exponent) and that will lead to the exponent being set to 1111 1111 which stands for infinity (also the mantissa will be set to 0). There is another video of jan Misali on how floating points work i highly recommend that.
We only need to multiply the significand of floating numbers. Negative floating number can be seen as -1×1.xxxxx (x denotes any number). -1 is a odd function, just counting how many -1 you have, then you will know is it negative or not.
0.3 = 0.01001100110011.... =1.001100110011..... x 2^-2 biased exponent = 127-2=125 =01111101 sign = 1 as negetive number so floating point representation sign(1bit) - 1 exponent(8bits)- 01111101 mantissa(23bits)0011-0011-0011-0011-0011-001 Sir, In your presentation last(right) three digits are 010 different from mine 001. can you please say what's wrong in my representation. Thanks
I rounded up the last one that would appear outside the bounds of what the mantissa can store, which effectively added a 1 to the end of the term, which caused a carry one spot further to the left.
This is what I did, and is a reasonable thing to do. However, the standard actually defines alternate rounding options as well. Details here: en.wikipedia.org/wiki/IEEE_floating_point#Rounding_rules
I am trying to solve this number 0.250 x 7, but i am getting 7 as the answer with this method, am i doing something wrong? Because converting 0.250 to floating gives 1.000 0000 0000 0000 0000 0000 x 2^-2..can someone help..?
+Madhu Kashyap Since 7 is 111 in binary, and 0.25 = 0.01, when you multiply 0.01 * 111 you should get 1.11 in binary which is 1.75 in decimal. This method should give that result. If that's not what you are getting, then I'll need to see your work to be able to comment.
I'm adding the actual unbiased exponents rather than the biased exponents. Since I have to subtract the bias from each one, and then add back one bias to the final result, I have effectively subtracted the bias once overall. However, in the computer, you can simply add the biased exponents directly, and then subtract the bias value once to get a result that is already biased.
The answer would be the same, you would just reach it in a different way. You only subtract the bias if you were originally adding biased exponents. The biased exponents were 125 and 135. 125 + 135 - 127 = 133, and then we add one to normalize the significand and get 134. This is the same as adding 8 + (-2) = 6, normalizing to get 7, then biasing to get 7 + 127 = 134.
the exponent of Y which is 8 was added with 127, in which i found incorrect... because the exponent is positive so we should subtract 127 to 8... EXPONENT value is 1110001001 for Y...
still helping students in 2024, thanks man
Thanks for the detailed explanation of large binary repeating binary.
damn boi,
4 just explaining the damn 3 steps, you could have choosen a shorter binary number
Watching it in quarentine for online exams...btw nice explaination
shouldn't the last 2 bits on the x significant be 01? As in the repeating 0011?
+Alpha Yeti The last 1 of the sequence 0011 goes outside of the bounds of the significand, so the number has to be rounded up. This causes the result above, and also explains why floating point numbers cannot precisely represent certain values.
This is nice and all, but what if X_E + Y_E > 255, that is to say, what if the new exponent is to large to be represented in 8 bits?
Do we just cap it at 255 since this is the best we can do?
you have to subtract the bias 127 (2^(n-1) -1) from that number dear. basically the equation is Bias exponent = actual exponent - bias.
thats a special case. if the exponent is too large to be displayed in 8 bits the result of that multiplication will be + or - infinity (depending on the sign bit). Usually a Full Adder or Carry-Look-Ahead Adder or whatever you use to multiply numbers has a mechanism that detects whether there is an overflow happening (in the exponent) and that will lead to the exponent being set to 1111 1111 which stands for infinity (also the mantissa will be set to 0). There is another video of jan Misali on how floating points work i highly recommend that.
Thanks! helped me in 2019.
What if we have negative sign how we can do the multiplication between positive and négative
We only need to multiply the significand of floating numbers.
Negative floating number can be seen as -1×1.xxxxx (x denotes any number).
-1 is a odd function, just counting how many -1 you have, then you will know is it negative or not.
Easy to understand.
Thanks!
0.3 = 0.01001100110011....
=1.001100110011..... x 2^-2
biased exponent = 127-2=125
=01111101
sign = 1 as negetive number
so floating point representation
sign(1bit) - 1
exponent(8bits)- 01111101 mantissa(23bits)0011-0011-0011-0011-0011-001
Sir, In your presentation last(right) three digits are 010 different from mine 001. can you please say what's wrong in my representation.
Thanks
I rounded up the last one that would appear outside the bounds of what the mantissa can store, which effectively added a 1 to the end of the term, which caused a carry one spot further to the left.
Got it ! So if last three digits of mantissa is 011 then it will be 100 ??
This is what I did, and is a reasonable thing to do. However, the standard actually defines alternate rounding options as well. Details here: en.wikipedia.org/wiki/IEEE_floating_point#Rounding_rules
Complex stuff .. explained with ease
I am trying to solve this number 0.250 x 7, but i am getting 7 as the answer with this method, am i doing something wrong?
Because converting 0.250 to floating gives 1.000 0000 0000 0000 0000 0000 x 2^-2..can someone help..?
+Madhu Kashyap Since 7 is 111 in binary, and 0.25 = 0.01, when you multiply 0.01 * 111 you should get 1.11 in binary which is 1.75 in decimal. This method should give that result. If that's not what you are getting, then I'll need to see your work to be able to comment.
should'nt we subtract the bias value?
I'm adding the actual unbiased exponents rather than the biased exponents. Since I have to subtract the bias from each one, and then add back one bias to the final result, I have effectively subtracted the bias once overall. However, in the computer, you can simply add the biased exponents directly, and then subtract the bias value once to get a result that is already biased.
so if we subtract shouldn't it be 7-127?
The answer would be the same, you would just reach it in a different way. You only subtract the bias if you were originally adding biased exponents. The biased exponents were 125 and 135. 125 + 135 - 127 = 133, and then we add one to normalize the significand and get 134. This is the same as adding 8 + (-2) = 6, normalizing to get 7, then biasing to get 7 + 127 = 134.
thank u
you are great sir!!
the exponent of Y which is 8 was added with 127, in which i found incorrect... because the exponent is positive so we should subtract 127 to 8... EXPONENT value is 1110001001 for Y...
you add the excess(127) not subtract. The whole reason for you adding the excess is to make sure it's a positive number.
Youre goD🙏🔥🔥
Awesome job
Strong perseverance
I have a no. 0.250*8 . Can I multiply it simply first and then convert into floating point? Will it be a right way or not? Reply fast.
You can multiply it first
Thank you sir...
You rock!
Thanks!
thanks! very good explanation
grazie
still helping in 2025.
Dec 2019😁
Hardcore
no way dude
I'm giving it up 😵💫🥲