[m-dev.] arithmetic simplification

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Dec 8 20:51:40 AEDT 1999


On 24-Nov-1999, Thomas Conway <conway at cs.mu.OZ.AU> wrote:
> 
> I was just noticing that the compiler doesn't simplify floating point
> multiplications by either 1.000000000 or 0.0000000000. Is this because
> noone got round to it, or is it because it changes program semantics?

Both, I think.

Note that for IEEE float, Inf * 0.0 = NaN, I think,
so X * 0.0 = X is not a valid simplification in general.
Off-hand I think X * 1.0 = X is probably safe,
although I haven't checked the relevant standard.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list