agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
Mathematical Functions and Operators
2+ messages / 2 participants
[nested] [flat]

* Mathematical Functions and Operators
@ 2024-09-08 04:43 PG Doc comments form <noreply@postgresql.org>
  2024-09-11 11:32 ` Re: Mathematical Functions and Operators David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Doc comments form @ 2024-09-08 04:43 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: pramodsavant2001@gmail.com

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.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Mathematical Functions and Operators
  2024-09-08 04:43 Mathematical Functions and Operators PG Doc comments form <noreply@postgresql.org>
@ 2024-09-11 11:32 ` David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: David G. Johnston @ 2024-09-11 11:32 UTC (permalink / raw)
  To: pramodsavant2001@gmail.com <pramodsavant2001@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>

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:

https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-PRECEDENCE

David J.

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-09-11 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-09-08 04:43 Mathematical Functions and Operators PG Doc comments form <noreply@postgresql.org>
2024-09-11 11:32 ` David G. Johnston <david.g.johnston@gmail.com>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox