Commit 742403bd authored by Tom Lane's avatar Tom Lane

Update 'Mathematical Functions' table to reflect 7.3 addition of float8

forms of ceil(), floor(), sign().  Back-patch this and other recent
doc fixes in this file to the 7.3 branch.
parent b3d7af46
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.134 2002/12/06 05:20:12 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.135 2003/01/23 01:22:59 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -520,17 +520,13 @@ PostgreSQL documentation ...@@ -520,17 +520,13 @@ PostgreSQL documentation
<para> <para>
<xref linkend="functions-math-func-table"> shows the available <xref linkend="functions-math-func-table"> shows the available
mathematical functions. In the table, <literal>dp</literal> mathematical functions. In the table, <literal>dp</literal>
indicates <type>double precision</type>. The functions indicates <type>double precision</type>. Many of these functions
<function>exp</function>, <function>ln</function>, are provided in multiple forms with different argument types.
<function>log</function>, <function>pow</function>, Except where noted, any given form of a function returns the same
<function>round</function> (1 argument), <function>sqrt</function>, datatype as its argument.
and <function>trunc</function> (1 argument) are also available for The functions working with <type>double precision</type> data are mostly
the type <type>numeric</type> in place of <type>double implemented on top of the host system's C library; accuracy and behavior in
precision</type>. Functions returning a <type>numeric</type> boundary cases may therefore vary depending on the host system.
result take <type>numeric</type> input arguments, unless otherwise
specified. Many of these functions are implemented on top of the
host system's C library; accuracy and behavior in boundary cases
could therefore vary depending on the host system.
</para> </para>
<table id="functions-math-func-table"> <table id="functions-math-func-table">
...@@ -564,8 +560,8 @@ PostgreSQL documentation ...@@ -564,8 +560,8 @@ PostgreSQL documentation
</row> </row>
<row> <row>
<entry><function>ceil</function>(<type>numeric</type>)</entry> <entry><function>ceil</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>numeric</type></entry> <entry>(same as input)</entry>
<entry>smallest integer not less than argument</entry> <entry>smallest integer not less than argument</entry>
<entry><literal>ceil(-42.8)</literal></entry> <entry><literal>ceil(-42.8)</literal></entry>
<entry>-42</entry> <entry>-42</entry>
...@@ -580,32 +576,32 @@ PostgreSQL documentation ...@@ -580,32 +576,32 @@ PostgreSQL documentation
</row> </row>
<row> <row>
<entry><function>exp</function>(<type>dp</type>)</entry> <entry><function>exp</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>dp</type></entry> <entry>(same as input)</entry>
<entry>exponential</entry> <entry>exponential</entry>
<entry><literal>exp(1.0)</literal></entry> <entry><literal>exp(1.0)</literal></entry>
<entry>2.71828182845905</entry> <entry>2.71828182845905</entry>
</row> </row>
<row> <row>
<entry><function>floor</function>(<type>numeric</type>)</entry> <entry><function>floor</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>numeric</type></entry> <entry>(same as input)</entry>
<entry>largest integer not greater than argument</entry> <entry>largest integer not greater than argument</entry>
<entry><literal>floor(-42.8)</literal></entry> <entry><literal>floor(-42.8)</literal></entry>
<entry>-43</entry> <entry>-43</entry>
</row> </row>
<row> <row>
<entry><function>ln</function>(<type>dp</type>)</entry> <entry><function>ln</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>dp</type></entry> <entry>(same as input)</entry>
<entry>natural logarithm</entry> <entry>natural logarithm</entry>
<entry><literal>ln(2.0)</literal></entry> <entry><literal>ln(2.0)</literal></entry>
<entry>0.693147180559945</entry> <entry>0.693147180559945</entry>
</row> </row>
<row> <row>
<entry><function>log</function>(<type>dp</type>)</entry> <entry><function>log</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>dp</type></entry> <entry>(same as input)</entry>
<entry>base 10 logarithm</entry> <entry>base 10 logarithm</entry>
<entry><literal>log(100.0)</literal></entry> <entry><literal>log(100.0)</literal></entry>
<entry>2</entry> <entry>2</entry>
...@@ -638,14 +634,23 @@ PostgreSQL documentation ...@@ -638,14 +634,23 @@ PostgreSQL documentation
</row> </row>
<row> <row>
<entry><function>pow</function>(<parameter>e</parameter> <type>dp</type>, <entry><function>pow</function>(<parameter>x</parameter> <type>dp</type>,
<parameter>n</parameter> <type>dp</type>)</entry> <parameter>e</parameter> <type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>raise a number to exponent <parameter>e</parameter></entry> <entry>raise a number to exponent <parameter>e</parameter></entry>
<entry><literal>pow(9.0, 3.0)</literal></entry> <entry><literal>pow(9.0, 3.0)</literal></entry>
<entry>729</entry> <entry>729</entry>
</row> </row>
<row>
<entry><function>pow</function>(<parameter>x</parameter> <type>numeric</type>,
<parameter>e</parameter> <type>numeric</type>)</entry>
<entry><type>numeric</type></entry>
<entry>raise a number to exponent <parameter>e</parameter></entry>
<entry><literal>pow(9.0, 3.0)</literal></entry>
<entry>729</entry>
</row>
<row> <row>
<entry><function>radians</function>(<type>dp</type>)</entry> <entry><function>radians</function>(<type>dp</type>)</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
...@@ -657,14 +662,14 @@ PostgreSQL documentation ...@@ -657,14 +662,14 @@ PostgreSQL documentation
<row> <row>
<entry><function>random</function>()</entry> <entry><function>random</function>()</entry>
<entry><type>dp</type></entry> <entry><type>dp</type></entry>
<entry>value between 0.0 to 1.0</entry> <entry>random value between 0.0 and 1.0</entry>
<entry><literal>random()</literal></entry> <entry><literal>random()</literal></entry>
<entry></entry> <entry></entry>
</row> </row>
<row> <row>
<entry><function>round</function>(<type>dp</type>)</entry> <entry><function>round</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>dp</type></entry> <entry>(same as input)</entry>
<entry>round to nearest integer</entry> <entry>round to nearest integer</entry>
<entry><literal>round(42.4)</literal></entry> <entry><literal>round(42.4)</literal></entry>
<entry>42</entry> <entry>42</entry>
...@@ -686,32 +691,31 @@ PostgreSQL documentation ...@@ -686,32 +691,31 @@ PostgreSQL documentation
</row> </row>
--> -->
<row> <row>
<entry><function>sign</function>(<type>numeric</type>)</entry> <entry><function>sign</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>numeric</type></entry> <entry>(same as input)</entry>
<entry>sign of the argument (-1, 0, +1)</entry> <entry>sign of the argument (-1, 0, +1)</entry>
<entry><literal>sign(-8.4)</literal></entry> <entry><literal>sign(-8.4)</literal></entry>
<entry>-1</entry> <entry>-1</entry>
</row> </row>
<row> <row>
<entry><function>sqrt</function>(<type>dp</type>)</entry> <entry><function>sqrt</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>dp</type></entry> <entry>(same as input)</entry>
<entry>square root</entry> <entry>square root</entry>
<entry><literal>sqrt(2.0)</literal></entry> <entry><literal>sqrt(2.0)</literal></entry>
<entry>1.4142135623731</entry> <entry>1.4142135623731</entry>
</row> </row>
<row> <row>
<entry><function>trunc</function>(<type>dp</type>)</entry> <entry><function>trunc</function>(<type>dp</type> or <type>numeric</type>)</entry>
<entry><type>dp</type></entry> <entry>(same as input)</entry>
<entry>truncate toward zero</entry> <entry>truncate toward zero</entry>
<entry><literal>trunc(42.8)</literal></entry> <entry><literal>trunc(42.8)</literal></entry>
<entry>42</entry> <entry>42</entry>
</row> </row>
<row> <row>
<entry><function>trunc</function>(<type>numeric</type>, <entry><function>trunc</function>(<parameter>v</parameter> <type>numeric</type>, <parameter>s</parameter> <type>integer</type>)</entry>
<parameter>r</parameter> <type>integer</type>)</entry>
<entry><type>numeric</type></entry> <entry><type>numeric</type></entry>
<entry>truncate to <parameter>s</parameter> decimal places</entry> <entry>truncate to <parameter>s</parameter> decimal places</entry>
<entry><literal>trunc(42.4382, 2)</literal></entry> <entry><literal>trunc(42.4382, 2)</literal></entry>
...@@ -725,7 +729,7 @@ PostgreSQL documentation ...@@ -725,7 +729,7 @@ PostgreSQL documentation
<para> <para>
Finally, <xref linkend="functions-math-trig-table"> shows the Finally, <xref linkend="functions-math-trig-table"> shows the
available trigonometric functions. All trigonometric functions available trigonometric functions. All trigonometric functions
have arguments and return values of type <type>double take arguments and return values of type <type>double
precision</type>. precision</type>.
</para> </para>
...@@ -2043,7 +2047,7 @@ PostgreSQL documentation ...@@ -2043,7 +2047,7 @@ PostgreSQL documentation
<para> <para>
This section describes functions and operators for examining and This section describes functions and operators for examining and
manipulating binary string values. Strings in this context include manipulating binary string values. Strings in this context mean
values of the type <type>BYTEA</type>. values of the type <type>BYTEA</type>.
</para> </para>
...@@ -2146,7 +2150,8 @@ PostgreSQL documentation ...@@ -2146,7 +2150,8 @@ PostgreSQL documentation
</row> </row>
<row> <row>
<entry><function>set_byte</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry> <entry><function>set_byte</function>(<parameter>string</parameter>,
<parameter>offset</parameter>, <parameter>newvalue</>)</entry>
<entry><type>bytea</type></entry> <entry><type>bytea</type></entry>
<entry> <entry>
Set byte in string. Set byte in string.
...@@ -2172,7 +2177,8 @@ PostgreSQL documentation ...@@ -2172,7 +2177,8 @@ PostgreSQL documentation
</row> </row>
<row> <row>
<entry><function>set_bit</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry> <entry><function>set_bit</function>(<parameter>string</parameter>,
<parameter>offset</parameter>, <parameter>newvalue</>)</entry>
<entry><type>bytea</type></entry> <entry><type>bytea</type></entry>
<entry> <entry>
Set bit in string. Set bit in string.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment