Skip to content

Commit 7fa1e1e

Browse files
committed
Doc: improve documentation about exponentiation operator.
Now that we're not having to wedge this into the straitjacket of the old operator table format, we can add another example to clarify the point about left-to-right associativity. Per suggestion from mdione at grulic.org.ar. https://postgr.es/m/162661954599.693.13700316547731859171@wrigleys.postgresql.org
1 parent aaec237 commit 7fa1e1e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

doc/src/sgml/func.sgml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,16 +988,23 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
988988
<returnvalue>double precision</returnvalue>
989989
</para>
990990
<para>
991-
Exponentiation (unlike typical mathematical practice, multiple uses of
992-
<literal>^</literal> will associate left to right)
991+
Exponentiation
993992
</para>
994993
<para>
995994
<literal>2 ^ 3</literal>
996995
<returnvalue>8</returnvalue>
997996
</para>
997+
<para>
998+
Unlike typical mathematical practice, multiple uses of
999+
<literal>^</literal> will associate left to right by default:
1000+
</para>
9981001
<para>
9991002
<literal>2 ^ 3 ^ 3</literal>
10001003
<returnvalue>512</returnvalue>
1004+
</para>
1005+
<para>
1006+
<literal>2 ^ (3 ^ 3)</literal>
1007+
<returnvalue>134217728</returnvalue>
10011008
</para></entry>
10021009
</row>
10031010

0 commit comments

Comments
 (0)