Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!apple!sticks!dwb From: dwb@sticks.apple.com (David Berry) Newsgroups: comp.unix.aux Subject: Re: cc and gcc problems Message-ID: <8022@goofy.Apple.COM> Date: 2 May 90 20:58:14 GMT References: <2749@husc6.harvard.edu> <12749@smoke.BRL.MIL> Sender: usenet@Apple.COM Organization: Apple Computer Lines: 18 In article <12749@smoke.BRL.MIL> cjohnson@smoke.BRL.MIL (Christopher T. Johnson) writes: >On a related note the verion of gcc(1.37) available from apple.com >generates bad code. I have two test cases that fail. In both cases >the code was checking to see if a double was near zero. > > {double junk = 0.0; > if (junk <0.0001 && junk > -0.0001) { > fprintf(stderr,"junk almost equal zero\n"); > } else { > fprintf(stderr,"junk != zero ??????\n"); > } > } Actually, this is a bug in the A/UX assembler. Gcc is generating valid code that the assembler generates byte code for. To get around it, always use the -O option (optimize) when dealing with floating point constants. David W. Berry A/UX Toolbox Engineer dwb@apple.com