From: Phillip Gawlowski Date: 2010-11-26T04:03:58+09:00 Subject: Re: Ruby 1.8 vs 1.9 On Thu, Nov 25, 2010 at 6:25 PM, Oliver Schad wrote: > Phillip Gawlowski wrote: > >> I'm quite aware that IEEE 754 defines the result of x_0/0 as infinity. > > The point is that you can't guarantee that you has a 0 with floiting > point aithmetics. You can. In mathematics. The problem is, as you pointed out, that a 32 bit (or 64 bit, or n bit where n is finite) CPU isn't able to present floating point numbers accurately enough. However, 0 = 0.0 (no matter how much Yuri moves the goal posts). You run into this issue once you leave the defined space for IEEE Floats (~10^-44 for negative floats), *then* you enter very wonky areas. But a flat 0.0 is only non-zero for computers. But not in maths. Ergo, from a mathematical standpoint, the IEEE standard is broken. > Every value you have to read as "as close as possible > to the meant value for this machine and this number size". IOW: It's a limit (and an approximate one at that, but it's "good enough" for pretty much all purposes). > The machines are not perfect they can't work mathematical correct in > many situations. Only in floats, and with integers that are larger than the total address space. But then we have the problem of the required CPU time to consider. > And you have to deal with this situation - all people doing numeric > things know that. Doing numeric calculations with a computer means to > calculate something as near as possible in the given environment and > requirements. Indeed. The problem is if the desired accuracy is much more exact than the IEEE float defines. > So in this sense is dividing a number through zero in real computers > dividing something which is close to the number, which I mean through > something which is close to zero. Not quite. Integer devision is behaving properly, Float isn't, even with only one significant digit. > And in fact it's not a bad idea to define if you have something which is > very close to zero (because you don't know if it's exactly zero), you > should treat it as very close to zero and not zero itself. Well, infinity isn't close to zero, either. ;) -- Phillip Gawlowski Though the folk I have met, (Ah, how soon!) they forget When I've moved on to some other place, There may be one or two, When I've played and passed through, Who'll remember my song or my face.