11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.134 2002/12/06 05:20:12 momjian Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.135 2003/01/23 01:22:59 tgl Exp $
33PostgreSQL documentation
44-->
55
@@ -520,17 +520,13 @@ PostgreSQL documentation
520520 <para>
521521 <xref linkend="functions-math-func-table"> shows the available
522522 mathematical functions. In the table, <literal>dp</literal>
523- indicates <type>double precision</type>. The functions
524- <function>exp</function>, <function>ln</function>,
525- <function>log</function>, <function>pow</function>,
526- <function>round</function> (1 argument), <function>sqrt</function>,
527- and <function>trunc</function> (1 argument) are also available for
528- the type <type>numeric</type> in place of <type>double
529- precision</type>. Functions returning a <type>numeric</type>
530- result take <type>numeric</type> input arguments, unless otherwise
531- specified. Many of these functions are implemented on top of the
532- host system's C library; accuracy and behavior in boundary cases
533- could therefore vary depending on the host system.
523+ indicates <type>double precision</type>. Many of these functions
524+ are provided in multiple forms with different argument types.
525+ Except where noted, any given form of a function returns the same
526+ datatype as its argument.
527+ The functions working with <type>double precision</type> data are mostly
528+ implemented on top of the host system's C library; accuracy and behavior in
529+ boundary cases may therefore vary depending on the host system.
534530 </para>
535531
536532 <table id="functions-math-func-table">
@@ -564,8 +560,8 @@ PostgreSQL documentation
564560 </row>
565561
566562 <row>
567- <entry><function>ceil</function>(<type>numeric</type>)</entry>
568- <entry><type>numeric</type> </entry>
563+ <entry><function>ceil</function>(<type>dp</type> or <type> numeric</type>)</entry>
564+ <entry>(same as input) </entry>
569565 <entry>smallest integer not less than argument</entry>
570566 <entry><literal>ceil(-42.8)</literal></entry>
571567 <entry>-42</entry>
@@ -580,32 +576,32 @@ PostgreSQL documentation
580576 </row>
581577
582578 <row>
583- <entry><function>exp</function>(<type>dp</type>)</entry>
584- <entry><type>dp</type> </entry>
579+ <entry><function>exp</function>(<type>dp</type> or <type>numeric</type> )</entry>
580+ <entry>(same as input) </entry>
585581 <entry>exponential</entry>
586582 <entry><literal>exp(1.0)</literal></entry>
587583 <entry>2.71828182845905</entry>
588584 </row>
589585
590586 <row>
591- <entry><function>floor</function>(<type>numeric</type>)</entry>
592- <entry><type>numeric</type> </entry>
587+ <entry><function>floor</function>(<type>dp</type> or <type> numeric</type>)</entry>
588+ <entry>(same as input) </entry>
593589 <entry>largest integer not greater than argument</entry>
594590 <entry><literal>floor(-42.8)</literal></entry>
595591 <entry>-43</entry>
596592 </row>
597593
598594 <row>
599- <entry><function>ln</function>(<type>dp</type>)</entry>
600- <entry><type>dp</type> </entry>
595+ <entry><function>ln</function>(<type>dp</type> or <type>numeric</type> )</entry>
596+ <entry>(same as input) </entry>
601597 <entry>natural logarithm</entry>
602598 <entry><literal>ln(2.0)</literal></entry>
603599 <entry>0.693147180559945</entry>
604600 </row>
605601
606602 <row>
607- <entry><function>log</function>(<type>dp</type>)</entry>
608- <entry><type>dp</type> </entry>
603+ <entry><function>log</function>(<type>dp</type> or <type>numeric</type> )</entry>
604+ <entry>(same as input) </entry>
609605 <entry>base 10 logarithm</entry>
610606 <entry><literal>log(100.0)</literal></entry>
611607 <entry>2</entry>
@@ -638,14 +634,23 @@ PostgreSQL documentation
638634 </row>
639635
640636 <row>
641- <entry><function>pow</function>(<parameter>e </parameter> <type>dp</type>,
642- <parameter>n </parameter> <type>dp</type>)</entry>
637+ <entry><function>pow</function>(<parameter>x </parameter> <type>dp</type>,
638+ <parameter>e </parameter> <type>dp</type>)</entry>
643639 <entry><type>dp</type></entry>
644640 <entry>raise a number to exponent <parameter>e</parameter></entry>
645641 <entry><literal>pow(9.0, 3.0)</literal></entry>
646642 <entry>729</entry>
647643 </row>
648644
645+ <row>
646+ <entry><function>pow</function>(<parameter>x</parameter> <type>numeric</type>,
647+ <parameter>e</parameter> <type>numeric</type>)</entry>
648+ <entry><type>numeric</type></entry>
649+ <entry>raise a number to exponent <parameter>e</parameter></entry>
650+ <entry><literal>pow(9.0, 3.0)</literal></entry>
651+ <entry>729</entry>
652+ </row>
653+
649654 <row>
650655 <entry><function>radians</function>(<type>dp</type>)</entry>
651656 <entry><type>dp</type></entry>
@@ -657,14 +662,14 @@ PostgreSQL documentation
657662 <row>
658663 <entry><function>random</function>()</entry>
659664 <entry><type>dp</type></entry>
660- <entry>value between 0.0to 1.0</entry>
665+ <entry>random value between 0.0and 1.0</entry>
661666 <entry><literal>random()</literal></entry>
662667 <entry></entry>
663668 </row>
664669
665670 <row>
666- <entry><function>round</function>(<type>dp</type>)</entry>
667- <entry><type>dp</type> </entry>
671+ <entry><function>round</function>(<type>dp</type> or <type>numeric</type> )</entry>
672+ <entry>(same as input) </entry>
668673 <entry>round to nearest integer</entry>
669674 <entry><literal>round(42.4)</literal></entry>
670675 <entry>42</entry>
@@ -686,32 +691,31 @@ PostgreSQL documentation
686691 </row>
687692-->
688693 <row>
689- <entry><function>sign</function>(<type>numeric</type>)</entry>
690- <entry><type>numeric</type> </entry>
694+ <entry><function>sign</function>(<type>dp</type> or <type> numeric</type>)</entry>
695+ <entry>(same as input) </entry>
691696 <entry>sign of the argument (-1, 0, +1)</entry>
692697 <entry><literal>sign(-8.4)</literal></entry>
693698 <entry>-1</entry>
694699 </row>
695700
696701 <row>
697- <entry><function>sqrt</function>(<type>dp</type>)</entry>
698- <entry><type>dp</type> </entry>
702+ <entry><function>sqrt</function>(<type>dp</type> or <type>numeric</type> )</entry>
703+ <entry>(same as input) </entry>
699704 <entry>square root</entry>
700705 <entry><literal>sqrt(2.0)</literal></entry>
701706 <entry>1.4142135623731</entry>
702707 </row>
703708
704709 <row>
705- <entry><function>trunc</function>(<type>dp</type>)</entry>
706- <entry><type>dp</type> </entry>
710+ <entry><function>trunc</function>(<type>dp</type> or <type>numeric</type> )</entry>
711+ <entry>(same as input) </entry>
707712 <entry>truncate toward zero</entry>
708713 <entry><literal>trunc(42.8)</literal></entry>
709714 <entry>42</entry>
710715 </row>
711716
712717 <row>
713- <entry><function>trunc</function>(<type>numeric</type>,
714- <parameter>r</parameter> <type>integer</type>)</entry>
718+ <entry><function>trunc</function>(<parameter>v</parameter> <type>numeric</type>, <parameter>s</parameter> <type>integer</type>)</entry>
715719 <entry><type>numeric</type></entry>
716720 <entry>truncate to <parameter>s</parameter> decimal places</entry>
717721 <entry><literal>trunc(42.4382, 2)</literal></entry>
@@ -725,7 +729,7 @@ PostgreSQL documentation
725729 <para>
726730 Finally, <xref linkend="functions-math-trig-table"> shows the
727731 available trigonometric functions. All trigonometric functions
728- have arguments and return values of type <type>double
732+ take arguments and return values of type <type>double
729733 precision</type>.
730734 </para>
731735
@@ -2043,7 +2047,7 @@ PostgreSQL documentation
20432047
20442048 <para>
20452049 This section describes functions and operators for examining and
2046- manipulating binary string values. Strings in this contextinclude
2050+ manipulating binary string values. Strings in this contextmean
20472051 values of the type <type>BYTEA</type>.
20482052 </para>
20492053
@@ -2146,7 +2150,8 @@ PostgreSQL documentation
21462150 </row>
21472151
21482152 <row>
2149- <entry><function>set_byte</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
2153+ <entry><function>set_byte</function>(<parameter>string</parameter>,
2154+ <parameter>offset</parameter>, <parameter>newvalue</>)</entry>
21502155 <entry><type>bytea</type></entry>
21512156 <entry>
21522157 Set byte in string.
@@ -2172,7 +2177,8 @@ PostgreSQL documentation
21722177 </row>
21732178
21742179 <row>
2175- <entry><function>set_bit</function>(<parameter>string</parameter>, <parameter>offset</parameter>)</entry>
2180+ <entry><function>set_bit</function>(<parameter>string</parameter>,
2181+ <parameter>offset</parameter>, <parameter>newvalue</>)</entry>
21762182 <entry><type>bytea</type></entry>
21772183 <entry>
21782184 Set bit in string.