mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add support for the error functions erf() and erfc().
Expose the standard error functions as SQL-callable functions. These are expected to be useful to people working with normal distributions, and we use them here to test the distribution from random_normal(). Since these functions are defined in the POSIX and C99 standards, they should in theory be available on all supported platforms. If that turns out not to be the case, more work will be needed. On all platforms tested so far, using extra_float_digits = -1 in the regression tests is sufficient to allow for variations between implementations. However, past experience has shown that there are almost certainly going to be additional unexpected portability issues, so these tests may well need further adjustments, based on the buildfarm results. Dean Rasheed, reviewed by Nathan Bossart and Thomas Munro. Discussion: https://postgr.es/m/CAEZATCXv5fi7+Vu-POiyai+ucF95+YMcCMafxV+eZuN1B-=MkQ@mail.gmail.com
This commit is contained in:
@ -1286,6 +1286,41 @@ repeat('Pg', 4) <returnvalue>PgPgPgPg</returnvalue>
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="func_table_entry"><para role="func_signature">
|
||||
<indexterm>
|
||||
<primary>erf</primary>
|
||||
</indexterm>
|
||||
<function>erf</function> ( <type>double precision</type> )
|
||||
<returnvalue>double precision</returnvalue>
|
||||
</para>
|
||||
<para>
|
||||
Error function
|
||||
</para>
|
||||
<para>
|
||||
<literal>erf(1.0)</literal>
|
||||
<returnvalue>0.8427007929497149</returnvalue>
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="func_table_entry"><para role="func_signature">
|
||||
<indexterm>
|
||||
<primary>erfc</primary>
|
||||
</indexterm>
|
||||
<function>erfc</function> ( <type>double precision</type> )
|
||||
<returnvalue>double precision</returnvalue>
|
||||
</para>
|
||||
<para>
|
||||
Complementary error function (<literal>1 - erf(x)</literal>, without
|
||||
loss of precision for large inputs)
|
||||
</para>
|
||||
<para>
|
||||
<literal>erfc(1.0)</literal>
|
||||
<returnvalue>0.15729920705028513</returnvalue>
|
||||
</para></entry>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<entry role="func_table_entry"><para role="func_signature">
|
||||
<indexterm>
|
||||
|
Reference in New Issue
Block a user