V125KJG8%UBVMS.BITNET@wiscvm.wisc.edu (03/20/87)
In article <652@sdchema.sdchem.UUCP> tps@sdchem.UUCP (Tom Stockfisch) writes: >In article <365@bms-at.UUCP> stuart@bms-at.UUCP (Stuart D. Gathman) writes: >>In article <4804@brl-adm.ARPA>,Schauble@mit-multics.arpa (Paul Schauble) writes: >>>...[claim that with float x,y, the test (x*y==x*y) can fail on many machines >Every single usage of "==" for floating point can fail? >What about > > double dflmax(); > double x = dflmax(); > > if ( x == dflmax() ) >or > double x = 0; > > if ( x == 0 ) > ... > > ? I can't accept the fact that (x * y == x * y) will fail, because the floating point will work the same way. Perhaps we mean something like this: if (7.0 * 5.0 == 35.0) /* which can fail */ Or, possibly this will fail: float x = 5.0, y = 7.0, z; z = x * y * y; z /= y; if (x * y == z) .. depending on how the CPU handles the floating point. Have fun and see yuh... --Curtis R. Anderson State University of New York at Buffalo (V125KJG8@UBVMS.bitnet) [opinions are my own, and do not necessairily represent views of SUNYAB. If they happen to do so, then that is strictly coincidence.]