J
@TheCPUWizard said:@da Doctah said:@too_many_usernames said:
Curiously, Wikipedia only lists two instances that interpret "-a^b" as the negative sign having higher precedence than exponentiation: Excel and some language called bc. And that's in the section "Gaps in the standard."
Anyone know of any other places that do this, for posterity's sake? Fortran. Assuming ** is merely local dialect for ^.
Too add to the confusion, consider all of the languages where caret ^ means something other then exponentiation (xor in some languages, pointer dereferencing in others, .....)
Trying again, with more tags
From the Fortran 77 standard - http://www.fortran.com/F77_std/f77_std.html exponentiation is much higher in precedence than unary plus or minus. It even gives this example:
For example, in the expression
- A ** 2
The exponentiation operator (**) has precedence over the negation operator (-); therefore, the operands of the exponentiation operator are combined to form an expression that is used as the operand of the negation operator. The interpretation of the above expression is the same as the interpretation of the expression
The Fortan 90 standard and the Fortan 95 standard (or at least the final draft of the F95 standartd) can be found on http://gcc.gnu.org/wiki/GFortranStandards and contains the same or similar text