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

nextafter.3p (5345B)


  1. '\" et
  2. .TH NEXTAFTER "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. nextafter,
  12. nextafterf,
  13. nextafterl,
  14. nexttoward,
  15. nexttowardf,
  16. nexttowardl
  17. \(em next representable floating-point number
  18. .SH SYNOPSIS
  19. .LP
  20. .nf
  21. #include <math.h>
  22. .P
  23. double nextafter(double \fIx\fP, double \fIy\fP);
  24. float nextafterf(float \fIx\fP, float \fIy\fP);
  25. long double nextafterl(long double \fIx\fP, long double \fIy\fP);
  26. double nexttoward(double \fIx\fP, long double \fIy\fP);
  27. float nexttowardf(float \fIx\fP, long double \fIy\fP);
  28. long double nexttowardl(long double \fIx\fP, long double \fIy\fP);
  29. .fi
  30. .SH DESCRIPTION
  31. The functionality described on this reference page is aligned with the
  32. ISO\ C standard. Any conflict between the requirements described here and the
  33. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  34. .P
  35. The
  36. \fInextafter\fR(),
  37. \fInextafterf\fR(),
  38. and
  39. \fInextafterl\fR()
  40. functions shall compute the next representable floating-point value
  41. following
  42. .IR x
  43. in the direction of
  44. .IR y .
  45. Thus, if
  46. .IR y
  47. is less than
  48. .IR x ,
  49. \fInextafter\fR()
  50. shall return the largest representable floating-point number less than
  51. .IR x .
  52. The
  53. \fInextafter\fR(),
  54. \fInextafterf\fR(),
  55. and
  56. \fInextafterl\fR()
  57. functions shall return
  58. .IR y
  59. if
  60. .IR x
  61. equals
  62. .IR y .
  63. .P
  64. The
  65. \fInexttoward\fR(),
  66. \fInexttowardf\fR(),
  67. and
  68. \fInexttowardl\fR()
  69. functions shall be equivalent to the corresponding
  70. \fInextafter\fR()
  71. functions, except that the second parameter shall have type
  72. .BR "long double"
  73. and the functions shall return
  74. .IR y
  75. converted to the type of the function if
  76. .IR x
  77. equals
  78. .IR y .
  79. .P
  80. An application wishing to check for error situations should set
  81. .IR errno
  82. to zero and call
  83. .IR feclearexcept (FE_ALL_EXCEPT)
  84. before calling these functions. On return, if
  85. .IR errno
  86. is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO |
  87. FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.
  88. .SH "RETURN VALUE"
  89. Upon successful completion, these functions shall return the next
  90. representable floating-point value following
  91. .IR x
  92. in the direction of
  93. .IR y .
  94. .P
  95. If
  96. .IR x ==\c
  97. .IR y ,
  98. .IR y
  99. (of the type
  100. .IR x )
  101. shall be returned.
  102. .P
  103. If
  104. .IR x
  105. is finite and the correct function value would overflow, a range error
  106. shall occur and \(+-HUGE_VAL, \(+-HUGE_VALF, and \(+-HUGE_VALL (with
  107. the same sign as
  108. .IR x )
  109. shall be returned as appropriate for the return type of the function.
  110. .P
  111. If
  112. .IR x
  113. or
  114. .IR y
  115. is NaN, a NaN shall be returned.
  116. .P
  117. If
  118. .IR x !=\c
  119. .IR y
  120. and the correct function value is subnormal, zero, or underflows,
  121. a range error shall occur, and
  122. .br
  123. the correct function value (if representable) or
  124. .br
  125. 0.0 shall be returned.
  126. .SH ERRORS
  127. These functions shall fail if:
  128. .IP "Range\ Error" 12
  129. The correct value overflows.
  130. .RS 12
  131. .P
  132. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  133. non-zero, then
  134. .IR errno
  135. shall be set to
  136. .BR [ERANGE] .
  137. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  138. non-zero, then the overflow floating-point exception shall be raised.
  139. .RE
  140. .IP "Range\ Error" 12
  141. The correct value is subnormal or underflows.
  142. .RS 12
  143. .P
  144. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  145. non-zero, then
  146. .IR errno
  147. shall be set to
  148. .BR [ERANGE] .
  149. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  150. non-zero, then the underflow floating-point exception shall be raised.
  151. .RE
  152. .LP
  153. .IR "The following sections are informative."
  154. .SH EXAMPLES
  155. None.
  156. .SH "APPLICATION USAGE"
  157. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  158. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  159. other, but at least one of them must be non-zero.
  160. .P
  161. When
  162. .IR <tgmath.h>
  163. is included, note that the return type of
  164. \fInextafter\fR()
  165. depends on the generic typing deduced from both arguments, while the
  166. return type of
  167. \fInexttoward\fR()
  168. depends only on the generic typing of the first argument.
  169. .SH RATIONALE
  170. None.
  171. .SH "FUTURE DIRECTIONS"
  172. None.
  173. .SH "SEE ALSO"
  174. .IR "\fIfeclearexcept\fR\^(\|)",
  175. .IR "\fIfetestexcept\fR\^(\|)"
  176. .P
  177. The Base Definitions volume of POSIX.1\(hy2017,
  178. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  179. .IR "\fB<math.h>\fP",
  180. .IR "\fB<tgmath.h>\fP"
  181. .\"
  182. .SH COPYRIGHT
  183. Portions of this text are reprinted and reproduced in electronic form
  184. from IEEE Std 1003.1-2017, Standard for Information Technology
  185. -- Portable Operating System Interface (POSIX), The Open Group Base
  186. Specifications Issue 7, 2018 Edition,
  187. Copyright (C) 2018 by the Institute of
  188. Electrical and Electronics Engineers, Inc and The Open Group.
  189. In the event of any discrepancy between this version and the original IEEE and
  190. The Open Group Standard, the original IEEE and The Open Group Standard
  191. is the referee document. The original Standard can be obtained online at
  192. http://www.opengroup.org/unix/online.html .
  193. .PP
  194. Any typographical or formatting errors that appear
  195. in this page are most likely
  196. to have been introduced during the conversion of the source files to
  197. man page format. To report such errors, see
  198. https://www.kernel.org/doc/man-pages/reporting_bugs.html .