Thread: Mathematical Functions and Operators
The following documentation comment has been logged on the website: Page: https://www.postgresql.org/docs/16/functions-math.html Description: Typically, exponentiation (which is represented here by ^) is a right-associative operation. This means that the expression 2 ^ 3 ^ 3 should be interpreted as 2 ^ (3 ^ 3) rather than (2 ^ 3) ^ 3. Correct Interpretation (right-associative): 2 ^ 3 ^ 3 is interpreted as 2 ^ (3 ^ 3), which equals 2 ^ 27 = 134217728. However, the example provided assumes left-associative behavior: Incorrect Interpretation (left-associative): 2 ^ 3 ^ 3 is incorrectly interpreted as (2 ^ 3) ^ 3 = 512.
On Saturday, September 7, 2024, PG Doc comments form <noreply@postgresql.org> wrote:
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/16/functions-math.html
Description:
Typically, exponentiation (which is represented here by ^) is a
right-associative operation.
We have documented our operator precedence decisions:
David J.