Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!TOADWAR.UCAR.EDU!gerry From: gerry@TOADWAR.UCAR.EDU (gerry wiener) Newsgroups: gnu.g++.bug Subject: (double) bug using g++-1.36.1 on sun4-os4.0.3 Message-ID: <8912012320.AA02156@toadwar.UCAR.EDU> Date: 2 Dec 89 01:20:39 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 38 When the program below is compiled and executed, it produces the following output: (many lines omitted) e = 8.98847e+307, f = 4.49423e+307 e = Inf, f = 8.98847e+307 e = Inf, f = Inf When the two lines containing cout are uncommented and the printf line is commented, the following output is produced: (many lines omitted) e is 8.98847e+307 f is 4.49423e+30 and the program hangs. A similar problem occurs when double is changed to float. ------------------------------------------------------------------------ #include main() { double e; double f; e = 2; f = 1; /* make larger */ while (e > f) { e *= 2; f *= 2; printf("e = %g, f = %g\n", e, f); /* cout << "e is " << e << '\n'; cout << "f is " << f << '\n';*/ } }