I am writing a little home-made calculator for integers and it includes two binary operators, ‘pow’ and ‘root’. The ‘pow’ operator evaluates (left operand) ^ (right operand), and the ‘root’ operator finds the largest number n such that n ^ (left operand) <= (right operand).
Assuming this isn’t an absurd thing to do, what should the precedence of these operators be? Currently I have them at equal precedence so strings such as
3 root 1500 pow 7
evaluate left to right. Is this right? Should I put this question on mathoverflow?
powandrootare essentially the same operation, expressed differently (similar to binary + and -). I.e.,sqrt(a)is the same aspow(a, 0.5), just likea + bis the same asa - (-b). So I’d say they should have equal precedence, and hence be evaluated left-to-right.