I think that it is basically a hack on the parser to allow 2 operators to be
adjacent, in each case of the unary - or unary +. One way around this is to
forbid 2 adjacent operators, and anyone who is tempted to use this
construction would get an error message, and then would insert parentheses
as appropriate.
This discussion happened at least two previous times between 1968 and 1974.
RJF
> -----Original Message-----
> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Robert Dodier
> Sent: Wednesday, October 25, 2006 6:05 PM
> To: macrakis at alum.mit.edu
> Cc: Maxima list
> Subject: Re: [Maxima] Parsing 2^-3*4 (WAS Maxima latex output)
>
> Stavros,
>
> > Are you sure about the consequences of the Fortran 77 rules?
>
> Well, http://fortran.com/F77_std/rjcnf-6.html seems clear
> enough, although there is no guarantee that all compiler
> writers (or users) will agree on the interpretation ....
>
> > What are the values of the following expressions in Fortran 77?
> >
> > 2.0^2*3
> > 2.0^-2*3
> > 2.0^(-2*3)
> > 2.0^(-2)*3
> > 2.0^-(2)*3
> > 2.0^2-3
>
> g77 (part of gcc) yields the following (same as what Ray
> stated in another message).
>
> 12.
> 0.015625
> 0.015625
> 0.75
> 0.015625
> 1.
>
> g77 has an option -Wsurprising which prints out warning
> messages for expressions such as the above.
> (But note that the description of -Wsurprising as shown by
> info g77 is confused about the actual behavior of the program.)
>
> By the way, this business with operator precedence bears on
> at least one reported bug, which has to do with the value of
> 1/+3*2 (or something like that). At present Maxima says that
> is 1/6, which consistent with F77. That is a consequence of
> the right binding power for + , which is 100 (i.e. less than * ).
> We could resolve that bug by approving the current behavior,
> and changing rbp of - to be 100 also, for consistency. Just a thought.
>
> All the best
> Robert
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>