]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/erf.3
man*/: ffix (un-bracket tables)
[thirdparty/man-pages.git] / man3 / erf.3
1 '\" t
2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
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 (faith@cs.unc.edu)
13 .\" Modified 2002-07-27 by Walter Harms
14 .\" (walter.harms@informatik.uni-oldenburg.de)
15 .\"
16 .TH erf 3 (date) "Linux man-pages (unreleased)"
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 .PP
26 .BI "double erf(double " x );
27 .BI "float erff(float " x );
28 .BI "long double erfl(long double " x );
29 .PP
30 .fi
31 .RS -4
32 Feature Test Macro Requirements for glibc (see
33 .BR feature_test_macros (7)):
34 .RE
35 .PP
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 .PP
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 .PP
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 .PP
65 If
66 .I x
67 is a NaN, a NaN is returned.
68 .PP
69 If
70 .I x
71 is +0 (\-0), +0 (\-0) is returned.
72 .PP
73 If
74 .I x
75 is positive infinity (negative infinity),
76 +1 (\-1) is returned.
77 .PP
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 .PP
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 .PP
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 .sp 1
120 .SH STANDARDS
121 C11, POSIX.1-2008.
122 .SH HISTORY
123 C99, POSIX.1-2001.
124 .PP
125 The variant returning
126 .I double
127 also conforms to
128 SVr4, 4.3BSD.
129 .SH SEE ALSO
130 .BR cerf (3),
131 .BR erfc (3),
132 .BR exp (3)