Re: Floating point constant question

maydan@mti.mti.sgi.com (Dror Maydan)
Tue, 29 Mar 1994 23:13:00 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)
Re: Floating point constant question chase@Think.COM (1994-03-30)
Re: Floating point constant question hbaker@netcom.com (1994-03-31)
Re: Floating point constant question przemek@rrdjazz.nist.gov (1994-03-31)
| List of all articles for this month |
Newsgroups: comp.compilers
From: maydan@mti.mti.sgi.com (Dror Maydan)
Keywords: arithmetic, optimize
Organization: Silicon Graphics Inc.
References: 94-03-157 94-03-176
Date: Tue, 29 Mar 1994 23:13:00 GMT

Scott Mahlke <mahlke@crhc.uiuc.edu> writes:
|> I have a question regarding the following compiler optimization:


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


David Chase <chase@Think.COM> wrote:
>I don't know of any compilers that do, and if they did them generally
>(i.e., if they'd do exactly what you did) then I wouldn't buy them. If
>your goal is to not change the I/O behavior of a legal program (something
>I always take for granted as a constraint on an optimizer), then my rule


The trend seems to be in the opposite direction. For example, when
compiling with -O3, IBM's compilers will perform mathematically equivalent
but numerically different transformations (I don't know if recipricol is
one of them). This can be overridden by using the -qstrict option.
Although I don't have details, I believe that other vendors also do
similar things.


IMHO, this is also the right way to do things. If the user carefully
ordered his instructions to be numerically stable, then it's no big deal
to ask him to tell the compiler not to rearrange things. For the other
users, there's no reason to force them to do the optimizer's job
(rearranging code to get optimal performance).


Dror
--


Post a followup to this message

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