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

expm1.3p (4681B)


  1. '\" et
  2. .TH EXPM1 "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. .SH NAME
  11. expm1,
  12. expm1f,
  13. expm1l
  14. \(em compute exponential functions
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <math.h>
  19. .P
  20. double expm1(double \fIx\fP);
  21. float expm1f(float \fIx\fP);
  22. long double expm1l(long double \fIx\fP);
  23. .fi
  24. .SH DESCRIPTION
  25. The functionality described on this reference page is aligned with the
  26. ISO\ C standard. Any conflict between the requirements described here and the
  27. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  28. .P
  29. These functions shall compute \fIe\u\s-3x\s+3\d\fR\-1.0.
  30. .P
  31. An application wishing to check for error situations should set
  32. .IR errno
  33. to zero and call
  34. .IR feclearexcept (FE_ALL_EXCEPT)
  35. before calling these functions. On return, if
  36. .IR errno
  37. is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO |
  38. FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.
  39. .SH "RETURN VALUE"
  40. Upon successful completion, these functions return
  41. \fIe\s-3\ux\d\s+3\fR\-1.0.
  42. .P
  43. If the correct value would cause overflow, a range error shall occur
  44. and
  45. \fIexpm1\fR(),
  46. \fIexpm1f\fR(),
  47. and
  48. \fIexpm1l\fR()
  49. shall return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL,
  50. respectively.
  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
  65. .IR x
  66. is +Inf,
  67. .IR x
  68. shall be returned.
  69. .P
  70. If
  71. .IR x
  72. is subnormal, a range error may occur
  73. .br
  74. and
  75. .IR x
  76. should be returned.
  77. .P
  78. If
  79. .IR x
  80. is not returned,
  81. \fIexpm1\fR(),
  82. \fIexpm1f\fR(),
  83. and
  84. \fIexpm1l\fR()
  85. shall return an implementation-defined value no greater in magnitude
  86. than DBL_MIN, FLT_MIN, and LDBL_MIN, respectively.
  87. .SH ERRORS
  88. These functions shall fail if:
  89. .IP "Range\ Error" 12
  90. The result overflows.
  91. .RS 12
  92. .P
  93. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  94. non-zero, then
  95. .IR errno
  96. shall be set to
  97. .BR [ERANGE] .
  98. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  99. non-zero, then the overflow floating-point exception shall be raised.
  100. .RE
  101. .P
  102. These functions may fail if:
  103. .IP "Range\ Error" 12
  104. The value of
  105. .IR x
  106. is subnormal.
  107. .RS 12
  108. .P
  109. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  110. non-zero, then
  111. .IR errno
  112. shall be set to
  113. .BR [ERANGE] .
  114. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  115. non-zero, then the underflow floating-point exception shall be raised.
  116. .RE
  117. .LP
  118. .IR "The following sections are informative."
  119. .SH EXAMPLES
  120. None.
  121. .SH "APPLICATION USAGE"
  122. The value of
  123. .IR expm1 ( x )
  124. may be more accurate than
  125. .IR exp ( x )\-1.0
  126. for small values of
  127. .IR x .
  128. .P
  129. The
  130. \fIexpm1\fR()
  131. and
  132. \fIlog1p\fR()
  133. functions are useful for financial calculations of
  134. ((1+\fIx\fR)\u\s-3\fIn\fR\s+3\d\-1)/\fIx\fR, namely:
  135. .sp
  136. .RS 4
  137. .nf
  138. expm1(\fIn\fP * log1p(\fIx\fP))/\fIx\fP
  139. .fi
  140. .P
  141. .RE
  142. .P
  143. when
  144. .IR x
  145. is very small (for example, when calculating small daily interest
  146. rates). These functions also simplify writing accurate inverse
  147. hyperbolic functions.
  148. .P
  149. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  150. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  151. other, but at least one of them must be non-zero.
  152. .SH RATIONALE
  153. None.
  154. .SH "FUTURE DIRECTIONS"
  155. None.
  156. .SH "SEE ALSO"
  157. .IR "\fIexp\fR\^(\|)",
  158. .IR "\fIfeclearexcept\fR\^(\|)",
  159. .IR "\fIfetestexcept\fR\^(\|)",
  160. .IR "\fIilogb\fR\^(\|)",
  161. .IR "\fIlog1p\fR\^(\|)"
  162. .P
  163. The Base Definitions volume of POSIX.1\(hy2017,
  164. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  165. .IR "\fB<math.h>\fP"
  166. .\"
  167. .SH COPYRIGHT
  168. Portions of this text are reprinted and reproduced in electronic form
  169. from IEEE Std 1003.1-2017, Standard for Information Technology
  170. -- Portable Operating System Interface (POSIX), The Open Group Base
  171. Specifications Issue 7, 2018 Edition,
  172. Copyright (C) 2018 by the Institute of
  173. Electrical and Electronics Engineers, Inc and The Open Group.
  174. In the event of any discrepancy between this version and the original IEEE and
  175. The Open Group Standard, the original IEEE and The Open Group Standard
  176. is the referee document. The original Standard can be obtained online at
  177. http://www.opengroup.org/unix/online.html .
  178. .PP
  179. Any typographical or formatting errors that appear
  180. in this page are most likely
  181. to have been introduced during the conversion of the source files to
  182. man page format. To report such errors, see
  183. https://www.kernel.org/doc/man-pages/reporting_bugs.html .