karl@haddock.ima.isc.com (Karl Heuer) (08/12/89)
In article <152@servio.UUCP> penneyj@servio.UUCP (D. Jason Penney) writes: >note that with truncating underflow, it is possible to have two floating >point values X and Y such that X != Y and yet (X - Y) == 0.0, >thus vitiating such precautions as, > if (X == Y) error("zero divide"); else something = 1.0 / (X - Y); I used to have similar problems with the SIMULA compiler on TOPS-10, which apparently used fuzzy compare even against zero: (example in C notation) if (X < 0.0) error("neg sqrt"); else something = sqrt(X); would die because -1.0E-20 was considered "equal" to zero rather than negative, yet the sqrt() routine wasn't fooled. What a pain to work around! Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint (What's this doing in comp.lang.c? Followups to comp.lang.misc.)