(j3.2006) mathematical equivalence and MATMUL

Van Snyder van.snyder
Tue Oct 25 04:06:59 EDT 2016


I have pointed out several times that the license to substitute a
mathematically equivalent expression applies only to intrinsic
operations, which are in turn denoted by intrinsic operators.

For example, 10.1.5.2.4 states "Once the interpretation of a numeric
intrinsic operation is established, the processor may evaluate any
mathematically equivalent expression, provided that the integrity of
parentheses is not violated."

10.1.5.1 states "A numeric intrinsic operation 1 is an intrinsic
operation for which the intrinsic-operator is a numeric operator (+, -,
*, /, or **).

Similar pairs of statements apply to other intrinsic operations.

I have found no license to apply the "mathematical equivalence" rule to
intrinsic functions.

On Mon, 2016-10-24 at 20:33 -0700, Robert Corbett wrote:
> A user recently complained about an "optimization"
> performed by Oracle Developer Studio Fortran.  The
> user's expression
> 
>        2.0 * MATMUL(A, B)
> 
> was "optimized" into the mathematically equivalent
> expression
> 
>        MATMUL(2.0*A, B)
> 
> Moving the multiplication into the first argument
> resulted in an overflow that would not have occurred
> for the original expression.
> 
> Is the optimization shown allowed by the Fortran standard?
> 
> If the integrity of parentheses rule applies to the
> parentheses around an actual argument list, the
> optimization shown would be prohibited.  Many
> desirable optimizations would also be prohibited.
> 
> If the original expression had been written as
> 
>        2.0 * (MATMUL(A, B))
> 
> would the optimization be allowed by the Fortran
> standard?  I think not, but Oracle Developer Studio
> Fortran still does the optimization in this case.
> 
> Robert Corbett
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3





More information about the J3 mailing list