Messages in this thread | | | From | rpm <> | Subject | Re: FPU, i386 | Date | Thu, 25 Apr 2002 18:39:38 +0530 |
| |
On Wednesday 17 April 2002 08:10 pm, Jesse Pollard wrote: > --------- Received message begins Here --------- >
> if (int(1/h * 100) == int(5.0 * 100)) > > will give a "proper" result within two decimal places. This is still > limited since there are irrational numbers within that range that COULD > still come out with a wrong answer, but is much less likely to occur. > > Exact match of floating point is not possible - 1/h is eleveated to a > float. > > If your 1/h was actually num/h, and num computed by summing .01 100 times > I suspect the result would also be "wrong". >
why is exact match of floating point not possible ? what i understand is if you do a " x/y " (where x and y are two integers ) division in hardware then you should always get the same value , then why can't we compare floating point "==" operation ? I understand that in case of inrrational number it will not give a exact value ......but division like 1/.2 is not irrational ! and it should always come to 5 ! rpm - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |