>>>>> "Stavros" == Stavros Macrakis <macrakis at gmail.com> writes:
Stavros> On 10/25/06, Robert Dodier <robert.dodier at gmail.com> wrote:
>> On 10/24/06, Raymond Toy <raymond.toy at ericsson.com> wrote:
>> > Isn't exp(-x)*y the correct parsing of %e^-x*y?
>> Opinions differ. Fortran 77 gives unary negation the same precedence
>> as subtraction, and gives both the same precedence as addition.
>> That is the policy implemented by :lisp (put '$- 100 'rbp) in Maxima.
>> In that case, %e^-x*y parses as %e^(-(x*y)).
Stavros> Are you sure about the consequences of the Fortran 77 rules? Doesn't
Stavros> exponentiation have higher precedence than both addition and
Stavros> multiplication? Is negation really the issue? What are the values of
Stavros> the following expressions in Fortran 77?
Stavros> 2.0^2*3
Stavros> 2.0^-2*3
Stavros> 2.0^(-2*3)
Stavros> 2.0^(-2)*3
Stavros> 2.0^-(2)*3
Stavros> 2.0^2-3
With Sun Fortran using the following program:
print *, 2.0**2*3
print *, 2.0**-2*3
print *, 2.0**(-2*3)
print *, 2.0**(-2)*3
print *, 2.0**-(2)*3
print *, 2.0**2-3
end
I get the following output:
12.0000
1.56250E-02
1.56250E-02
0.750000
1.56250E-02
1.00000
So it is as Robert says: 2.0^-2*3 is parsed as 2^(-6). I think the
other parsings are rather weird. Or, rather, don't match my own
expectations, which may or may not be right.
Ray