as you know single number will save in memory by following format:
(-1)^s * 1.f * 2^e:
and zero will save like that: 1.0000000000000000 * 2 ^ -126
now If I multiply it to another floating point number like 3.37 (-1) ^ 0 * 1.10101111 * 2 ^ 128
it will not 0 it reality,but in computer it will be 0 ,how and why?
As pointed out here (Wikipedia, sorry …), there are special values for the exponent which are treated differently. If the exponent is zero, the formula for calculating the value of the number is
So, a floating point zero has simply all bits set to zero (i.e.
f=0, s=0, e=0). The multiplication algorithms of course have to take care of this “special” exponent and set the result to zero in this case (more specifically to +Zero or -Zero accordingly …)