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

log2.3p (4024B)


  1. '\" et
  2. .TH LOG2 "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. log2,
  12. log2f,
  13. log2l
  14. \(em compute base 2 logarithm functions
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <math.h>
  19. .P
  20. double log2(double \fIx\fP);
  21. float log2f(float \fIx\fP);
  22. long double log2l(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 compute the base 2 logarithm of their argument
  30. .IR x ,
  31. log\s-3\d2\u\s+3(\fIx\fR).
  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 base 2
  43. logarithm of
  44. .IR x .
  45. .P
  46. If
  47. .IR x
  48. is \(+-0, a pole error shall occur and
  49. \fIlog2\fR(),
  50. \fIlog2f\fR(),
  51. and
  52. \fIlog2l\fR()
  53. shall return \-HUGE_VAL, \-HUGE_VALF, and \-HUGE_VALL,
  54. respectively.
  55. .P
  56. For finite values of
  57. .IR x
  58. that are less than 0,
  59. or if
  60. .IR x
  61. is \-Inf,
  62. a domain error shall occur, and
  63. either a NaN (if supported), or
  64. an implementation-defined value shall be returned.
  65. .P
  66. If
  67. .IR x
  68. is NaN, a NaN shall be returned.
  69. .P
  70. If
  71. .IR x
  72. is 1, +0 shall be returned.
  73. .P
  74. If
  75. .IR x
  76. is +Inf,
  77. .IR x
  78. shall be returned.
  79. .SH ERRORS
  80. These functions shall fail if:
  81. .IP "Domain\ Error" 12
  82. The finite value of
  83. .IR x
  84. is less than zero,
  85. or
  86. .IR x
  87. is \-Inf.
  88. .RS 12
  89. .P
  90. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  91. non-zero, then
  92. .IR errno
  93. shall be set to
  94. .BR [EDOM] .
  95. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  96. non-zero, then the invalid floating-point exception shall be raised.
  97. .RE
  98. .IP "Pole\ Error" 12
  99. The value of
  100. .IR x
  101. is zero.
  102. .RS 12
  103. .P
  104. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  105. non-zero, then
  106. .IR errno
  107. shall be set to
  108. .BR [ERANGE] .
  109. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  110. non-zero, then the divide-by-zero floating-point exception shall be
  111. 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 "\fIlog\fR\^(\|)"
  129. .P
  130. The Base Definitions volume of POSIX.1\(hy2017,
  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 .