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

lround.3p (4704B)


  1. '\" et
  2. .TH LROUND "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. lround,
  12. lroundf,
  13. lroundl
  14. \(em round to nearest integer value
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <math.h>
  19. .P
  20. long lround(double \fIx\fP);
  21. long lroundf(float \fIx\fP);
  22. long lroundl(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 round their argument to the nearest integer
  30. value, rounding halfway cases away from zero, regardless of the current
  31. rounding direction.
  32. .P
  33. An application wishing to check for error situations should set
  34. .IR errno
  35. to zero and call
  36. .IR feclearexcept (FE_ALL_EXCEPT)
  37. before calling these functions. On return, if
  38. .IR errno
  39. is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO |
  40. FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.
  41. .SH "RETURN VALUE"
  42. Upon successful completion, these functions shall return the rounded
  43. integer value.
  44. .P
  45. If
  46. .IR x
  47. is NaN, a domain error shall occur and an unspecified value is
  48. returned.
  49. .P
  50. If
  51. .IR x
  52. is +Inf, a domain error shall occur and an unspecified value is
  53. returned.
  54. .P
  55. If
  56. .IR x
  57. is \-Inf, a domain error shall occur and an unspecified value is
  58. returned.
  59. .P
  60. If the correct value is positive and too large to represent as a
  61. .BR long ,
  62. an unspecified value shall be returned.
  63. On systems that support the IEC 60559 Floating-Point option, a domain
  64. shall occur;
  65. otherwise, a
  66. domain
  67. error may occur.
  68. .P
  69. If the correct value is negative and too large to represent as a
  70. .BR long ,
  71. an unspecified value shall be returned.
  72. On systems that support the IEC 60559 Floating-Point option, a domain
  73. shall occur;
  74. otherwise, a
  75. domain
  76. error may occur.
  77. .SH ERRORS
  78. These functions shall fail if:
  79. .IP "Domain\ Error" 12
  80. The
  81. .IR x
  82. argument is NaN or \(+-Inf, or the correct value is not representable
  83. as an integer.
  84. .RS 12
  85. .P
  86. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  87. non-zero, then
  88. .IR errno
  89. shall be set to
  90. .BR [EDOM] .
  91. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  92. non-zero, then the invalid floating-point exception shall be raised.
  93. .RE
  94. .P
  95. These functions may fail if:
  96. .IP "Domain\ Error" 12
  97. The correct value is not representable as an integer.
  98. .RS 12
  99. .P
  100. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  101. non-zero, then
  102. .IR errno
  103. shall be set to
  104. .BR [EDOM] .
  105. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  106. non-zero, then the invalid floating-point exception shall be raised.
  107. .RE
  108. .LP
  109. .IR "The following sections are informative."
  110. .SH EXAMPLES
  111. None.
  112. .SH "APPLICATION USAGE"
  113. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  114. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  115. other, but at least one of them must be non-zero.
  116. .SH RATIONALE
  117. These functions differ from the
  118. \fIlrint\fR()
  119. functions in the default rounding direction, with the
  120. \fIlround\fR()
  121. functions rounding halfway cases away from zero and needing not to
  122. raise the inexact floating-point exception for non-integer arguments
  123. that round to within the range of the return type.
  124. .SH "FUTURE DIRECTIONS"
  125. None.
  126. .SH "SEE ALSO"
  127. .IR "\fIfeclearexcept\fR\^(\|)",
  128. .IR "\fIfetestexcept\fR\^(\|)",
  129. .IR "\fIllround\fR\^(\|)"
  130. .P
  131. The Base Definitions volume of POSIX.1\(hy2017,
  132. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  133. .IR "\fB<math.h>\fP"
  134. .\"
  135. .SH COPYRIGHT
  136. Portions of this text are reprinted and reproduced in electronic form
  137. from IEEE Std 1003.1-2017, Standard for Information Technology
  138. -- Portable Operating System Interface (POSIX), The Open Group Base
  139. Specifications Issue 7, 2018 Edition,
  140. Copyright (C) 2018 by the Institute of
  141. Electrical and Electronics Engineers, Inc and The Open Group.
  142. In the event of any discrepancy between this version and the original IEEE and
  143. The Open Group Standard, the original IEEE and The Open Group Standard
  144. is the referee document. The original Standard can be obtained online at
  145. http://www.opengroup.org/unix/online.html .
  146. .PP
  147. Any typographical or formatting errors that appear
  148. in this page are most likely
  149. to have been introduced during the conversion of the source files to
  150. man page format. To report such errors, see
  151. https://www.kernel.org/doc/man-pages/reporting_bugs.html .