Path: utzoo!utgpu!cunews!cognos!jimp From: jimp@cognos.UUCP (Jim Patterson) Newsgroups: comp.arch Subject: Re: Compilers, architecture, and efficiency Message-ID: <9596@cognos.UUCP> Date: 2 May 91 13:38:19 GMT References: <1991Apr28.154603.8003@rice.edu> <1991Apr29.155945.29907@rice.edu> <41279@genrad.UUCP> Reply-To: jimp@cognos.UUCP (Jim Patterson) Organization: Cognos Inc., Ottawa, Canada Lines: 23 In article peter@ficc.ferranti.com (peter da silva) writes: >If you want to specify a boolean operation on a float, do the following: > > f * 2.0 > >It's up to the compiler to determine if this multiplication by a constant >two can be handled by incrementing the exponent or if you have to do a real >floating multiply (say, for example, that it's m * e ^ 16). The problem with this is that the compiler rarely has enough information to determine if it's "safe" to just bump the exponent. Therefore it's left with the choice of doing a number of runtime checks (is f equal to zero? Is exponent already at upper limit?), or just punting and generating the naive "multiply by 2.0" instruction. I suspect most compilers will do the latter because it's ultimately more important to get the right answer. -- Jim Patterson Cognos Incorporated UUCP:uunet!mitel!cunews!cognos!jimp P.O. BOX 9707 PHONE:(613)738-1440 x6112 3755 Riverside Drive Ottawa, Ont K1G 3Z4