]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/erf.3
1bf0c89dbf2164547403ae270b6e9a31cf7ed9f1
[thirdparty/man-pages.git] / man3 / erf.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" References consulted:
26 .\" Linux libc source code
27 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\" 386BSD man pages
29 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 2002-07-27 by Walter Harms
31 .\" (walter.harms@informatik.uni-oldenburg.de)
32 .\"
33 .TH ERF 3 2008-07-29 "GNU" "Linux Programmer's Manual"
34 .SH NAME
35 erf, erff, erfl, \- error function
36 .SH SYNOPSIS
37 .nf
38 .B #include <math.h>
39
40 .BI "double erf(double " x );
41 .BI "float erff(float " x );
42 .BI "long double erfl(long double " x );
43
44 .fi
45 Link with \fI\-lm\fP.
46 .sp
47 .in -4n
48 Feature Test Macro Requirements for glibc (see
49 .BR feature_test_macros (7)):
50 .in
51 .sp
52 .ad l
53 .BR erf (),
54 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE || _ISOC99_SOURCE; or
55 .I cc\ -std=c99
56 .br
57 .BR erff (),
58 .BR erfl (),
59 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600|| _ISOC99_SOURCE; or
60 .I cc\ -std=c99
61 .ad b
62 .SH DESCRIPTION
63 The
64 .BR erf ()
65 function returns the error function of \fIx\fP, defined
66 as
67 .TP
68 erf(x) = 2/sqrt(pi)* integral from 0 to x of exp(\-t*t) dt
69 .SH RETURN VALUE
70 On success, these functions return the error function of
71 .IR x ,
72 a value in the range [\-1,1].
73
74 If
75 .I x
76 is a NaN, a NaN is returned.
77
78 If
79 .I x
80 is +0 (\-0), +0 (\-0) is returned.
81
82 If
83 .I x
84 is positive infinity (negative infinity),
85 +1 (\-1) is returned.
86
87 If
88 .I x
89 is subnormal,
90 a "range error" occurs,
91 and the return value is 2*x/sqrt(pi).
92 .SH ERRORS
93 See
94 .BR math_error (7)
95 for information on how to determine whether an error has occurred
96 when calling these functions.
97 .PP
98 The following errors can occur:
99 .TP
100 Range error: result underflow (\fIx\fP is subnormal)
101 .\" .I errno
102 .\" is set to
103 .\" .BR ERANGE .
104 An underflow floating-point exception
105 .RB ( FE_UNDERFLOW )
106 is raised.
107 .PP
108 These functions do not set
109 .IR errno .
110 .\" FIXME . Is it intentional that these functions do not set errno?
111 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6785
112 .SH "CONFORMING TO"
113 C99, POSIX.1-2001.
114 The variant returning
115 .I double
116 also conforms to
117 SVr4, 4.3BSD.
118 .SH "SEE ALSO"
119 .BR cerf (3),
120 .BR erfc (3),
121 .BR exp (3)