bc: Precedence

1 
1 3.5 Precedence
1 ==============
1 
1 The expression precedence is as follows: (lowest to highest)
1 
1      || operator, left associative
1      && operator, left associative
1      ! operator, nonassociative
1      Relational operators, left associative
1      Assignment operator, right associative
1      + and - operators, left associative
1      *, / and % operators, left associative
1      ^ operator, right associative
1      unary - operator, nonassociative
1      ++ and -- operators, nonassociative
1 
1    This precedence was chosen so that POSIX compliant 'bc' programs will
1 run correctly.  This will cause the use of the relational and logical
1 operators to have some unusual behavior when used with assignment
1 expressions.  Consider the expression:
1 
1      a = 3 < 5
1 
1    Most C programmers would assume this would assign the result of "3 <
1 5" (the value 1) to the variable "a".  What this does in 'bc' is assign
1 the value 3 to the variable "a" and then compare 3 to 5.  It is best to
1 use parentheses when using relational and logical operators with the
1 assignment operators.
1