Debian Codegraph @

upstream/debian-unstable/man3/erf.3

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