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

rint.3p (4065B)


  1. '\" et
  2. .TH RINT "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. rint,
  12. rintf,
  13. rintl
  14. \(em round-to-nearest integral value
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <math.h>
  19. .P
  20. double rint(double \fIx\fP);
  21. float rintf(float \fIx\fP);
  22. long double rintl(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 return the integral value (represented as a
  30. .BR double )
  31. nearest
  32. .IR x
  33. in the direction of the current rounding mode. The current rounding
  34. mode is implementation-defined.
  35. .P
  36. If the current rounding mode rounds toward negative infinity, then
  37. \fIrint\fR()
  38. shall be equivalent to
  39. .IR "\fIfloor\fR\^(\|)".
  40. If the current rounding mode rounds toward positive infinity, then
  41. \fIrint\fR()
  42. shall be equivalent to
  43. .IR "\fIceil\fR\^(\|)".
  44. If the current rounding mode rounds towards zero, then
  45. \fIrint\fR()
  46. shall be equivalent to
  47. .IR "\fItrunc\fR\^(\|)".
  48. If the current rounding mode rounds towards nearest, then
  49. \fIrint\fR()
  50. differs from
  51. .IR "\fIround\fR\^(\|)"
  52. in that halfway cases are rounded to even rather than away from zero.
  53. .P
  54. These functions differ from the
  55. \fInearbyint\fR(),
  56. \fInearbyintf\fR(),
  57. and
  58. \fInearbyintl\fR()
  59. functions only in that they may raise the inexact floating-point
  60. exception if the result differs in value from the argument.
  61. .P
  62. An application wishing to check for error situations should set
  63. .IR errno
  64. to zero and call
  65. .IR feclearexcept (FE_ALL_EXCEPT)
  66. before calling these functions. On return, if
  67. .IR errno
  68. is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO |
  69. FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.
  70. .SH "RETURN VALUE"
  71. Upon successful completion, these functions shall return the integer
  72. (represented as a double precision number) nearest
  73. .IR x
  74. in the direction of the current rounding mode.
  75. The result shall have the same sign as
  76. .IR x .
  77. .P
  78. If
  79. .IR x
  80. is NaN, a NaN shall be returned.
  81. .P
  82. If
  83. .IR x
  84. is \(+-0 or \(+-Inf,
  85. .IR x
  86. shall be returned.
  87. .SH ERRORS
  88. No errors are defined.
  89. .LP
  90. .IR "The following sections are informative."
  91. .SH EXAMPLES
  92. None.
  93. .SH "APPLICATION USAGE"
  94. The integral value returned by these functions need not be expressible
  95. as an
  96. .BR intmax_t .
  97. The return value should be tested before assigning it to an integer type
  98. to avoid the undefined results of an integer overflow.
  99. .SH RATIONALE
  100. None.
  101. .SH "FUTURE DIRECTIONS"
  102. None.
  103. .SH "SEE ALSO"
  104. .IR "\fIabs\fR\^(\|)",
  105. .IR "\fIceil\fR\^(\|)",
  106. .IR "\fIfeclearexcept\fR\^(\|)",
  107. .IR "\fIfetestexcept\fR\^(\|)",
  108. .IR "\fIfloor\fR\^(\|)",
  109. .IR "\fIisnan\fR\^(\|)",
  110. .IR "\fInearbyint\fR\^(\|)"
  111. .P
  112. The Base Definitions volume of POSIX.1\(hy2017,
  113. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  114. .IR "\fB<math.h>\fP"
  115. .\"
  116. .SH COPYRIGHT
  117. Portions of this text are reprinted and reproduced in electronic form
  118. from IEEE Std 1003.1-2017, Standard for Information Technology
  119. -- Portable Operating System Interface (POSIX), The Open Group Base
  120. Specifications Issue 7, 2018 Edition,
  121. Copyright (C) 2018 by the Institute of
  122. Electrical and Electronics Engineers, Inc and The Open Group.
  123. In the event of any discrepancy between this version and the original IEEE and
  124. The Open Group Standard, the original IEEE and The Open Group Standard
  125. is the referee document. The original Standard can be obtained online at
  126. http://www.opengroup.org/unix/online.html .
  127. .PP
  128. Any typographical or formatting errors that appear
  129. in this page are most likely
  130. to have been introduced during the conversion of the source files to
  131. man page format. To report such errors, see
  132. https://www.kernel.org/doc/man-pages/reporting_bugs.html .