|Optimizing IEEE Floating-Point Operations firstname.lastname@example.org (1991-06-06)|
|Re: Optimizing IEEE Floating-Point Operations email@example.com (1991-06-11)|
|Optimizing IEEE Floating-Point Operations bill@hcx2.SSD.CSD.HARRIS.COM (1991-06-14)|
|Optimizing IEEE Floating-Point Operations firstname.lastname@example.org (1991-06-14)|
|Optimizing IEEE Floating-Point Operations email@example.com (1991-06-17)|
|Re: Optimizing IEEE Floating-Point Operations firstname.lastname@example.org (1991-06-17)|
|Re: Optimizing IEEE Floating-Point Operations email@example.com (1991-06-18)|
|Re: Optimizing IEEE Floating-Point Operations firstname.lastname@example.org (1991-06-19)|
|From:||email@example.com (Bron Campbell Nelson)|
|Keywords:||arithmetic, design, Fortran, C|
|Date:||Tue, 11 Jun 91 12:02:48 -0700|
Daryl Odnert (firstname.lastname@example.org) writes:
> x = 0.0; /* statement A */
> y = y * x; /* statement B */
> Let us assume that x and y are floating-point variables and that the
> underlying machine uses the IEEE floating-point representation. Assuming
> that we can determine that x does not change between A and B, should the
> expression (y * x) in statement B be replaced with 0.0? What if y is a NaN?
My own *personal* opinion is that this is a legal transformation if and
only if the runtime system traps (and aborts) on generation of NaN's and
Inf's. For example, the Fortran standard clearly states that an expression
may be replaced by one that is "mathematically equivalent" but without
specifing just what kind of "mathematics." If your particular mathematical
model includes NaN's and Inf's (e.g. the IEEE model), then this transformation
is NOT strictly legal, since the expressions are not always equivalent.
On the other hand, if your mathematical model does not have things like
NaN's and Inf's (i.e. the program blows up if such numbers are produced)
then the transformation IS legal.
Probably the "right" thing to do is to add yet another compiler option
and support both the "strict IEEE" and "intuitive" models. Just my $0.02
Bron Campbell Nelson
Silicon Graphics, Inc.
2011 N. Shoreline Blvd.
Mtn. View, CA 94039
Return to the
Search the comp.compilers archives again.