Path: utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!olivea!oliveb!amdahl!rtech!ingres!daveb From: daveb@ingres.com (When a problem comes along . . . you must whip it) Newsgroups: comp.lang.c Subject: Compiler bug or gray area in C? Message-ID: <1990Nov28.220233.2630@ingres.Ingres.COM> Date: 28 Nov 90 22:02:33 GMT Reply-To: daveb@hydra.Ingres.COM (When a problem comes along . . . you must whip it) Organization: Ingres Corporation, Alameda CA 94501 Lines: 35 Given this simplification: extern double D, foo(); foo( i ) int i; { double x; int changes = 0; do { x = foo( i ); if( x < D ) { changed++; D = x; } } while( !changed ); } is it reasonable for this to not terminate? We see a number of compilers that keep x in a register with extended precision, so that it has bits that are not in the global D. Thus, the comparison (x < D) fails, even after D is assigned the value of x. Yes, floating point in C is peculiar, but is it _this_ peculiar? thanks, -dB -- "If it were easy to understand, we wouldn't call it 'code'" David Brower: {amdahl, cpsc6a, mtxinu, sun}!rtech!daveb daveb@ingres.com