Floating point constant question

Scott Mahlke <mahlke@crhc.uiuc.edu>
Mon, 28 Mar 1994 04:54:15 GMT

          From comp.compilers

Related articles
Floating point constant question mahlke@crhc.uiuc.edu (Scott Mahlke) (1994-03-28)
Re: Floating point constant question joe@sanskrit.ho.att.com (1994-03-29)
Re: Floating point constant question chase@Think.COM (1994-03-29)
Re: Floating point constant question bill@amber.csd.harris.com (1994-03-29)
Re: Floating point constant question maydan@mti.mti.sgi.com (1994-03-29)
Re: Floating point constant question hbaker@netcom.com (1994-03-30)
Re: Floating point constant question conte@ece.scarolina.edu (1994-03-30)
[3 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: Scott Mahlke <mahlke@crhc.uiuc.edu>
Keywords: arithmetic, optimize, question, comment
Organization: Compilers Central
Date: Mon, 28 Mar 1994 04:54:15 GMT

I have a question regarding the following compiler optimization:


x = y / 500.0; ===> x = y * 0.002;


The rationale being that FP multiply is faster than FP divide on the
target machine. However, when I do this in our compiler, I get quite of
bit of error on some of the fspec programs (mainly 034.mdljsp2,
090.hydro2d) due to the representation of both constants.


Is this or similar optimizations dealing with FP constants ever legal? Do
any compilers out there do optimizations such as this? Thanks.


Scott
---------
Scott Mahlke Center for Reliable and High-Performance Computing
mahlke@crhc.uiuc.edu University of Illinois at Urbana-Champaign
[In Fortran it's legal, although perhaps not a good idea. How much effect
it has on the code depends a lot on your floating point format. You
wouldn't be running on a Cray, would you? -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.