logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

erf.3p (4246B)


  1. '\" et
  2. .TH ERF "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .EQ
  11. delim $$
  12. .EN
  13. .SH NAME
  14. erf,
  15. erff,
  16. erfl
  17. \(em error functions
  18. .SH SYNOPSIS
  19. .LP
  20. .nf
  21. #include <math.h>
  22. .P
  23. double erf(double \fIx\fP);
  24. float erff(float \fIx\fP);
  25. long double erfl(long double \fIx\fP);
  26. .fi
  27. .SH DESCRIPTION
  28. The functionality described on this reference page is aligned with the
  29. ISO\ C standard. Any conflict between the requirements described here and the
  30. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  31. .P
  32. These functions shall compute the error function of their argument
  33. .IR x ,
  34. defined as:
  35. .sp
  36. .RS
  37. ${2 over sqrt pi} int from 0 to x e"^" " "{- t"^" 2" "} dt$
  38. .RE
  39. .P
  40. An application wishing to check for error situations should set
  41. .IR errno
  42. to zero and call
  43. .IR feclearexcept (FE_ALL_EXCEPT)
  44. before calling these functions. On return, if
  45. .IR errno
  46. is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO |
  47. FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.
  48. .SH "RETURN VALUE"
  49. Upon successful completion, these functions shall return the value of
  50. the error function.
  51. .P
  52. If
  53. .IR x
  54. is NaN, a NaN shall be returned.
  55. .P
  56. If
  57. .IR x
  58. is \(+-0, \(+-0 shall be returned.
  59. .P
  60. If
  61. .IR x
  62. is \(+-Inf, \(+-1 shall be returned.
  63. .P
  64. If the correct value would cause underflow, a range error may occur, and
  65. \fIerf\fR(),
  66. \fIerff\fR(),
  67. and
  68. \fIerfl\fR()
  69. shall return an implementation-defined value no greater in magnitude
  70. than DBL_MIN, FLT_MIN, and LDBL_MIN, respectively.
  71. .P
  72. If the IEC 60559 Floating-Point option is supported, 2 *
  73. .IR x /\c
  74. .IR sqrt (\(*p)
  75. should be returned.
  76. .SH ERRORS
  77. These functions may fail if:
  78. .IP "Range\ Error" 12
  79. The result underflows.
  80. .RS 12
  81. .P
  82. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  83. non-zero, then
  84. .IR errno
  85. shall be set to
  86. .BR [ERANGE] .
  87. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  88. non-zero, then the underflow floating-point exception shall be raised.
  89. .RE
  90. .br
  91. .LP
  92. .IR "The following sections are informative."
  93. .SH EXAMPLES
  94. .SS "Computing the Probability for a Normal Variate"
  95. .P
  96. This example shows how to use
  97. \fIerf\fR()
  98. to compute the probability that a normal variate assumes a value in the
  99. range [\fIx\fR1,\fIx\fR2] with \fIx\fR1\(<=\fIx\fR2.
  100. .P
  101. This example uses the constant M_SQRT1_2 which is part of the XSI option.
  102. .sp
  103. .RS 4
  104. .nf
  105. #include <math.h>
  106. .P
  107. double
  108. Phi(const double x1, const double x2)
  109. {
  110. return ( erf(x2*M_SQRT1_2) - erf(x1*M_SQRT1_2) ) / 2;
  111. }
  112. .fi
  113. .P
  114. .RE
  115. .SH "APPLICATION USAGE"
  116. Underflow occurs when |\fIx\fP| < DBL_MIN * (\c
  117. .IR sqrt (\(*p)/2).
  118. .P
  119. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  120. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  121. other, but at least one of them must be non-zero.
  122. .SH RATIONALE
  123. None.
  124. .SH "FUTURE DIRECTIONS"
  125. None.
  126. .SH "SEE ALSO"
  127. .IR "\fIerfc\fR\^(\|)",
  128. .IR "\fIfeclearexcept\fR\^(\|)",
  129. .IR "\fIfetestexcept\fR\^(\|)",
  130. .IR "\fIisnan\fR\^(\|)"
  131. .P
  132. The Base Definitions volume of POSIX.1\(hy2017,
  133. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  134. .IR "\fB<math.h>\fP"
  135. .\"
  136. .SH COPYRIGHT
  137. Portions of this text are reprinted and reproduced in electronic form
  138. from IEEE Std 1003.1-2017, Standard for Information Technology
  139. -- Portable Operating System Interface (POSIX), The Open Group Base
  140. Specifications Issue 7, 2018 Edition,
  141. Copyright (C) 2018 by the Institute of
  142. Electrical and Electronics Engineers, Inc and The Open Group.
  143. In the event of any discrepancy between this version and the original IEEE and
  144. The Open Group Standard, the original IEEE and The Open Group Standard
  145. is the referee document. The original Standard can be obtained online at
  146. http://www.opengroup.org/unix/online.html .
  147. .PP
  148. Any typographical or formatting errors that appear
  149. in this page are most likely
  150. to have been introduced during the conversion of the source files to
  151. man page format. To report such errors, see
  152. https://www.kernel.org/doc/man-pages/reporting_bugs.html .