Mathematical Functions and Operators

Поиск
Список
Период
Сортировка
От PG Doc comments form
Тема Mathematical Functions and Operators
Дата
Msg-id 172577058189.711.5933453138059481244@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: Mathematical Functions and Operators
Список pgsql-docs
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.

В списке pgsql-docs по дате отправления: