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

fdim.3p (4284B)


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