| 1 |
'\" t |
| 2 |
.\" Copyright 1993 David Metcalfe ([email protected]) |
| 3 |
.\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
| 4 |
.\" <[email protected]> |
| 5 |
.\" |
| 6 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 7 |
.\" |
| 8 |
.\" References consulted: |
| 9 |
.\" Linux libc source code |
| 10 |
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) |
| 11 |
.\" 386BSD man pages |
| 12 |
.\" Modified 1993-07-24 by Rik Faith ([email protected]) |
| 13 |
.\" Modified 2002-07-27 by Walter Harms |
| 14 |
.\" ([email protected]) |
| 15 |
.\" |
| 16 |
.TH erf 3 2024-05-02 "Linux man-pages 6.9.1" |
| 17 |
.SH NAME |
| 18 |
erf, erff, erfl \- error function |
| 19 |
.SH LIBRARY |
| 20 |
Math library |
| 21 |
.RI ( libm ", " \-lm ) |
| 22 |
.SH SYNOPSIS |
| 23 |
.nf |
| 24 |
.B #include <math.h> |
| 25 |
.P |
| 26 |
.BI "double erf(double " x ); |
| 27 |
.BI "float erff(float " x ); |
| 28 |
.BI "long double erfl(long double " x ); |
| 29 |
.P |
| 30 |
.fi |
| 31 |
.RS -4 |
| 32 |
Feature Test Macro Requirements for glibc (see |
| 33 |
.BR feature_test_macros (7)): |
| 34 |
.RE |
| 35 |
.P |
| 36 |
.BR erf (): |
| 37 |
.nf |
| 38 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE |
| 39 |
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE |
| 40 |
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE |
| 41 |
.fi |
| 42 |
.P |
| 43 |
.BR erff (), |
| 44 |
.BR erfl (): |
| 45 |
.nf |
| 46 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
| 47 |
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE |
| 48 |
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE |
| 49 |
.fi |
| 50 |
.SH DESCRIPTION |
| 51 |
These functions return the error function of |
| 52 |
.IR x , |
| 53 |
defined as |
| 54 |
.P |
| 55 |
.in +4n |
| 56 |
.EX |
| 57 |
erf(x) = 2/sqrt(pi) * integral from 0 to x of exp(\-t*t) dt |
| 58 |
.EE |
| 59 |
.in |
| 60 |
.SH RETURN VALUE |
| 61 |
On success, these functions return the value of the error function of |
| 62 |
.IR x , |
| 63 |
a value in the range [\-1,\ 1]. |
| 64 |
.P |
| 65 |
If |
| 66 |
.I x |
| 67 |
is a NaN, a NaN is returned. |
| 68 |
.P |
| 69 |
If |
| 70 |
.I x |
| 71 |
is +0 (\-0), +0 (\-0) is returned. |
| 72 |
.P |
| 73 |
If |
| 74 |
.I x |
| 75 |
is positive infinity (negative infinity), |
| 76 |
+1 (\-1) is returned. |
| 77 |
.P |
| 78 |
If |
| 79 |
.I x |
| 80 |
is subnormal, |
| 81 |
a range error occurs, |
| 82 |
and the return value is 2*x/sqrt(pi). |
| 83 |
.SH ERRORS |
| 84 |
See |
| 85 |
.BR math_error (7) |
| 86 |
for information on how to determine whether an error has occurred |
| 87 |
when calling these functions. |
| 88 |
.P |
| 89 |
The following errors can occur: |
| 90 |
.TP |
| 91 |
Range error: result underflow (\fIx\fP is subnormal) |
| 92 |
.\" .I errno |
| 93 |
.\" is set to |
| 94 |
.\" .BR ERANGE . |
| 95 |
An underflow floating-point exception |
| 96 |
.RB ( FE_UNDERFLOW ) |
| 97 |
is raised. |
| 98 |
.P |
| 99 |
These functions do not set |
| 100 |
.IR errno . |
| 101 |
.\" It is intentional that these functions do not set errno for this case |
| 102 |
.\" see https://www.sourceware.org/bugzilla/show_bug.cgi?id=6785 |
| 103 |
.SH ATTRIBUTES |
| 104 |
For an explanation of the terms used in this section, see |
| 105 |
.BR attributes (7). |
| 106 |
.TS |
| 107 |
allbox; |
| 108 |
lbx lb lb |
| 109 |
l l l. |
| 110 |
Interface Attribute Value |
| 111 |
T{ |
| 112 |
.na |
| 113 |
.nh |
| 114 |
.BR erf (), |
| 115 |
.BR erff (), |
| 116 |
.BR erfl () |
| 117 |
T} Thread safety MT-Safe |
| 118 |
.TE |
| 119 |
.SH STANDARDS |
| 120 |
C11, POSIX.1-2008. |
| 121 |
.SH HISTORY |
| 122 |
C99, POSIX.1-2001. |
| 123 |
.P |
| 124 |
The variant returning |
| 125 |
.I double |
| 126 |
also conforms to |
| 127 |
SVr4, 4.3BSD. |
| 128 |
.SH SEE ALSO |
| 129 |
.BR cerf (3), |
| 130 |
.BR erfc (3), |
| 131 |
.BR exp (3) |