Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!el.mcrcim.mcgill.edu!leei From: leei@el.mcrcim.mcgill.edu (Lee Iverson) Newsgroups: gnu.gcc.bug Subject: (none) Message-ID: <8906131454.AA05417@el.McRCIM.McGill.EDU> Date: 13 Jun 89 14:54:49 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 522 In the following script, the correct answers are provided without optimization. There seems to be a serious problem with the optimization of the logic in the if-then-else constructs of partition(). I am running a Sun3/50 with SunOS 3.5. We are configured with `config.gcc sun3' Lee Iverson ---- The file part.c #include #include const double mexp = 709.782713; double partition( double x, double p ) { double nx = p*x; printf("In partition(%f,%f): nx = %f\n",x,p,nx); if ( nx <= -0.5 ) return 0.0; else if ( nx >= 0.5 ) return 1.0; else { double tx = 2/(2*x+1) + 2/(2*x-1); if ( tx <= -mexp ) return 1.0; else if ( tx >= mexp ) return 0.0; else return 1/(1+exp(tx)); } } const int iterations = 1001; const double xstart = -0.55; const double xend = 0.55; main() { int i; double x; const double xincr = (xend-xstart)/(iterations-1); x = xstart; printf( "Part(%f) = %f\n", x, partition(x,1.0) ); x = xend; printf( "Part(%f) = %f\n", x, partition(x,1.0) ); /* for ( i=0, x=xstart; i