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

fmod.3p (4548B)


  1. '\" et
  2. .TH FMOD "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. fmod,
  12. fmodf,
  13. fmodl
  14. \(em floating-point remainder value function
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <math.h>
  19. .P
  20. double fmod(double \fIx\fP, double \fIy\fP);
  21. float fmodf(float \fIx\fP, float \fIy\fP);
  22. long double fmodl(long double \fIx\fP, long double \fIy\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 floating-point remainder of the
  30. division of
  31. .IR x
  32. by
  33. .IR y .
  34. .P
  35. An application wishing to check for error situations should set
  36. .IR errno
  37. to zero and call
  38. .IR feclearexcept (FE_ALL_EXCEPT)
  39. before calling these functions. On return, if
  40. .IR errno
  41. is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO |
  42. FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.
  43. .SH "RETURN VALUE"
  44. These functions shall return the value
  45. .IR x \-\c
  46. .IR i *\c
  47. .IR y ,
  48. for some integer
  49. .IR i
  50. such that, if
  51. .IR y
  52. is non-zero, the result has the same sign as
  53. .IR x
  54. and magnitude less than the magnitude of
  55. .IR y .
  56. .P
  57. If the correct value would cause underflow,
  58. and is not
  59. representable,
  60. a range error may occur, and
  61. \fIfmod\fR(),
  62. \fImodf\fR(),
  63. and
  64. \fIfmodl\fR()
  65. shall return
  66. 0.0, or
  67. (if the IEC 60559 Floating-Point option is not supported) an
  68. implementation-defined value no greater in magnitude than DBL_MIN,
  69. FLT_MIN, and LDBL_MIN, respectively.
  70. .P
  71. If
  72. .IR x
  73. or
  74. .IR y
  75. is NaN, a NaN shall be returned, and none of the conditions
  76. below shall be considered.
  77. .P
  78. If
  79. .IR y
  80. is zero, a domain error shall occur, and a NaN shall be returned.
  81. .P
  82. If
  83. .IR x
  84. is infinite, a domain error shall occur, and a NaN shall be returned.
  85. .P
  86. If
  87. .IR x
  88. is \(+-0 and
  89. .IR y
  90. is not zero, \(+-0 shall be returned.
  91. .P
  92. If
  93. .IR x
  94. is not infinite and
  95. .IR y
  96. is \(+-Inf,
  97. .IR x
  98. shall be returned.
  99. .P
  100. If the correct value would cause underflow, and is representable, a
  101. range error may occur and the correct value shall be returned.
  102. .SH ERRORS
  103. These functions shall fail if:
  104. .IP "Domain\ Error" 12
  105. The
  106. .IR x
  107. argument is infinite or
  108. .IR y
  109. is zero.
  110. .RS 12
  111. .P
  112. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  113. non-zero, then
  114. .IR errno
  115. shall be set to
  116. .BR [EDOM] .
  117. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  118. non-zero, then the invalid floating-point exception shall be raised.
  119. .RE
  120. .P
  121. These functions may fail if:
  122. .IP "Range\ Error" 12
  123. The result underflows.
  124. .RS 12
  125. .P
  126. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  127. non-zero, then
  128. .IR errno
  129. shall be set to
  130. .BR [ERANGE] .
  131. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  132. non-zero, then the underflow floating-point exception shall be raised.
  133. .RE
  134. .LP
  135. .IR "The following sections are informative."
  136. .SH EXAMPLES
  137. None.
  138. .SH "APPLICATION USAGE"
  139. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  140. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  141. other, but at least one of them must be non-zero.
  142. .SH RATIONALE
  143. None.
  144. .SH "FUTURE DIRECTIONS"
  145. None.
  146. .SH "SEE ALSO"
  147. .IR "\fIfeclearexcept\fR\^(\|)",
  148. .IR "\fIfetestexcept\fR\^(\|)",
  149. .IR "\fIisnan\fR\^(\|)"
  150. .P
  151. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  152. .IR "\fB<math.h>\fP"
  153. .\"
  154. .SH COPYRIGHT
  155. Portions of this text are reprinted and reproduced in electronic form
  156. from IEEE Std 1003.1-2017, Standard for Information Technology
  157. -- Portable Operating System Interface (POSIX), The Open Group Base
  158. Specifications Issue 7, 2018 Edition,
  159. Copyright (C) 2018 by the Institute of
  160. Electrical and Electronics Engineers, Inc and The Open Group.
  161. In the event of any discrepancy between this version and the original IEEE and
  162. The Open Group Standard, the original IEEE and The Open Group Standard
  163. is the referee document. The original Standard can be obtained online at
  164. http://www.opengroup.org/unix/online.html .
  165. .PP
  166. Any typographical or formatting errors that appear
  167. in this page are most likely
  168. to have been introduced during the conversion of the source files to
  169. man page format. To report such errors, see
  170. https://www.kernel.org/doc/man-pages/reporting_bugs.html .