<bbense+comp.lang.ruby.Aug.02.03 / telemark.slac.stanford.edu> wrote in message news:<bggl6e$d94$2 / news.Stanford.EDU>... > > - - The computational results are all "0" as well, they way to test > floating point computations for equality is to see if the > absolute value of their difference is less than EPS. Frankly, > I don't understand how this comes as a surprise to people. > You should not be allowed to use the / operator unless you > understand this. > > - - Booker C. Bense I don't understand the reason why you show such vanity, or why you need to make fun of previous posts. It's a fact that numerical analysis is a difficult domain, and unless you are able to explain each line of code in Netlib (for example :-), you shouldn't "be allowed to" post such things. In fact it is even funny to read your answer. I don't think it's a good idea to test equality that way. It will work in some cases, whene your numbers are near 1. I'd rather use a "relative" error, and sometimes it may be more complicated. It depends on what you need to compare. Here it's stupid to test absolute difference, since the goal was to show why you must not use "a!=b" with floating point numbers. To answer another post, "What every computer scientist..." is a chapter of the "Sun Computation Guide", which can be found at docs.sun.com. Those who are interested can visit William Kahan's home page, or search "ieee754" with google. Other sources of information are Netlib, at www.netlib.org (or www.netlib.no, much faster in Europe), or GAMS at NIST (gams.nist.gov). You could also have a look at Numerical Recipes (www.nr.com). You will find good sources for special functions and many other at Netlib.