Debian Codegraph @

doc/src/intrinsics/numeric/erf.md

raw
1 # erf(x): Error
2
3 Error function.
4
5 ## Declaration
6
7 ### Syntax
8
9 ```fortran
10 retval = erf(x)
11 elemental real function erf(x)
12 ```
13
14 ### Arguments
15
16 `x` the input value must be of type real.
17
18 ### Return values
19
20 The return value is of type real and of the same kind as of the input parameter
21 `x`.
22
23 ## Description
24
25 **erf(x)** computes the error function of `x`. The result lies in the range:
26
27 $-1 \leq erf (x) \leq 1$
28
29 It is calculated using:
30
31 $\frac{2}{\sqrt\pi}\int_0^xe^{-t^2}dt$
32
33 ## Types
34
35 Supported argument types is real.
36
37 ```fortran
38 interface erf
39 module procedure serf, derf
40 end interface
41
42 contains
43
44 elemental real(sp) function serf(x)
45 real(sp), intent(in) :: x
46 end function
47
48 elemental real(dp) function derf(x)
49 real(dp), intent(in) :: x
50 end function
51 ```
52
53 ## Examples
54
55 ```fortran
56 program intrinsics_erf
57 print *, erf(0.5)
58 end program
59 ```
60
61 **Result:**
62
63 ```
64 0.520499877
65 ```
66
67 ## See Also
68
69 [erfc](erfc.md).