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

ldexp.3p (4443B)


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