diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-03-12 15:55:09 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-03-12 15:55:09 -0400 |
commit | f1d85aa98ee71d9662309f6f0384b2f7f8f16f02 (patch) | |
tree | 16a5d8f1d531851888dc219653f5da97d894b812 /doc/src | |
parent | 3aa0395d4ed36f040f20da304c122b956529dd14 (diff) | |
download | postgresql-f1d85aa98ee71d9662309f6f0384b2f7f8f16f02.tar.gz postgresql-f1d85aa98ee71d9662309f6f0384b2f7f8f16f02.zip |
Add support for hyperbolic functions, as well as log10().
The SQL:2016 standard adds support for the hyperbolic functions
sinh(), cosh(), and tanh(). POSIX has long required libm to
provide those functions as well as their inverses asinh(),
acosh(), atanh(). Hence, let's just expose the libm functions
to the SQL level. As with the trig functions, we only implement
versions for float8, not numeric.
For the moment, we'll assume that all platforms actually do have
these functions; if experience teaches otherwise, some autoconf
effort may be needed.
SQL:2016 also adds support for base-10 logarithm, but with the
function name log10(), whereas the name we've long used is log().
Add aliases named log10() for the float8 and numeric versions.
Lætitia Avrot
Discussion: https://postgr.es/m/CAB_COdguG22LO=rnxDQ2DW1uzv8aQoUzyDQNJjrR4k00XSgm5w@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 107 |
1 files changed, 105 insertions, 2 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index afd1c433b4d..ca3aedc3306 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -897,6 +897,19 @@ </row> <row> + <entry> + <indexterm> + <primary>log10</primary> + </indexterm> + <literal><function>log10(<type>dp</type> or <type>numeric</type>)</function></literal> + </entry> + <entry>(same as input)</entry> + <entry>base 10 logarithm</entry> + <entry><literal>log10(100.0)</literal></entry> + <entry><literal>2</literal></entry> + </row> + + <row> <entry><literal><function>log(<parameter>b</parameter> <type>numeric</type>, <parameter>x</parameter> <type>numeric</type>)</function></literal></entry> <entry><type>numeric</type></entry> @@ -1147,8 +1160,8 @@ </para> <para> - Finally, <xref linkend="functions-math-trig-table"/> shows the - available trigonometric functions. All trigonometric functions + <xref linkend="functions-math-trig-table"/> shows the + available trigonometric functions. All these functions take arguments and return values of type <type>double precision</type>. Each of the trigonometric functions comes in two variants, one that measures angles in radians and one that @@ -1311,6 +1324,96 @@ </para> </note> + <para> + <xref linkend="functions-math-hyp-table"/> shows the + available hyperbolic functions. All these functions + take arguments and return values of type <type>double + precision</type>. + </para> + + <table id="functions-math-hyp-table"> + <title>Hyperbolic Functions</title> + + <tgroup cols="4"> + <thead> + <row> + <entry>Function</entry> + <entry>Description</entry> + <entry>Example</entry> + <entry>Result</entry> + </row> + </thead> + <tbody> + <row> + <entry> + <indexterm> + <primary>sinh</primary> + </indexterm> + <literal><function>sinh(<replaceable>x</replaceable>)</function></literal> + </entry> + <entry>hyperbolic sine</entry> + <entry><literal>sinh(0)</literal></entry> + <entry><literal>0</literal></entry> + </row> + <row> + <entry> + <indexterm> + <primary>cosh</primary> + </indexterm> + <literal><function>cosh(<replaceable>x</replaceable>)</function></literal> + </entry> + <entry>hyperbolic cosine</entry> + <entry><literal>cosh(0)</literal></entry> + <entry><literal>1</literal></entry> + </row> + <row> + <entry> + <indexterm> + <primary>tanh</primary> + </indexterm> + <literal><function>tanh(<replaceable>x</replaceable>)</function></literal> + </entry> + <entry>hyperbolic tangent</entry> + <entry><literal>tanh(0)</literal></entry> + <entry><literal>0</literal></entry> + </row> + <row> + <entry> + <indexterm> + <primary>asinh</primary> + </indexterm> + <literal><function>asinh(<replaceable>x</replaceable>)</function></literal> + </entry> + <entry>inverse hyperbolic sine</entry> + <entry><literal>asinh(0)</literal></entry> + <entry><literal>0</literal></entry> + </row> + <row> + <entry> + <indexterm> + <primary>acosh</primary> + </indexterm> + <literal><function>acosh(<replaceable>x</replaceable>)</function></literal> + </entry> + <entry>inverse hyperbolic cosine</entry> + <entry><literal>acosh(1)</literal></entry> + <entry><literal>0</literal></entry> + </row> + <row> + <entry> + <indexterm> + <primary>atanh</primary> + </indexterm> + <literal><function>atanh(<replaceable>x</replaceable>)</function></literal> + </entry> + <entry>inverse hyperbolic tangent</entry> + <entry><literal>atanh(0)</literal></entry> + <entry><literal>0</literal></entry> + </row> + </tbody> + </tgroup> + </table> + </sect1> |