Mathematical Functions and Operators

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: pramodsavant2001(at)gmail(dot)com
Subject: Mathematical Functions and Operators
Date: 2024-09-08 04:43:01
Message-ID: 172577058189.711.5933453138059481244@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Oleg Sibiryakov 2024-09-10 11:46:23 Re: Documentation improvement patch
Previous Message David G. Johnston 2024-09-07 20:07:53 Re: retrieving results of procedures with OUT params