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

tan.3p (5497B)


  1. '\" et
  2. .TH TAN "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. tan,
  12. tanf,
  13. tanl
  14. \(em tangent function
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <math.h>
  19. .P
  20. double tan(double \fIx\fP);
  21. float tanf(float \fIx\fP);
  22. long double tanl(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 tangent of their argument
  30. .IR x ,
  31. measured in radians.
  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 tangent of
  43. .IR x .
  44. .P
  45. If the correct value would cause underflow,
  46. and is not representable,
  47. a range error may occur, and
  48. \fItan\fR(),
  49. \fItanf\fR(),
  50. and
  51. \fItanl\fR()
  52. shall return
  53. 0.0, or
  54. (if IEC 60559 Floating-Point is not supported) an implementation-defined
  55. value no greater in magnitude than DBL_MIN, FLT_MIN, and LDBL_MIN,
  56. respectively.
  57. .P
  58. If
  59. .IR x
  60. is NaN, a NaN shall be returned.
  61. .P
  62. If
  63. .IR x
  64. is \(+-0,
  65. .IR x
  66. shall be returned.
  67. .P
  68. If
  69. .IR x
  70. is subnormal, a range error may occur
  71. .br
  72. and
  73. .IR x
  74. should be returned.
  75. .P
  76. If
  77. .IR x
  78. is not returned,
  79. \fItan\fR(),
  80. \fItanf\fR(),
  81. and
  82. \fItanl\fR()
  83. shall return an implementation-defined value no greater in magnitude
  84. than DBL_MIN, FLT_MIN, and LDBL_MIN, respectively.
  85. .P
  86. If
  87. .IR x
  88. is \(+-Inf, a domain error shall occur, and either a NaN (if
  89. supported), or an implementation-defined value shall be returned.
  90. .P
  91. If the correct value would cause underflow, and is representable,
  92. a range error may occur and the correct value shall be returned.
  93. .P
  94. If the correct value would cause overflow, a range error shall occur
  95. and
  96. \fItan\fR(),
  97. \fItanf\fR(),
  98. and
  99. \fItanl\fR()
  100. shall return \(+-HUGE_VAL, \(+-HUGE_VALF, and \(+-HUGE_VALL,
  101. respectively, with the same sign as the correct value of the function.
  102. .SH ERRORS
  103. These functions shall fail if:
  104. .IP "Domain\ Error" 12
  105. The value of
  106. .IR x
  107. is \(+-Inf.
  108. .RS 12
  109. .P
  110. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  111. non-zero, then
  112. .IR errno
  113. shall be set to
  114. .BR [EDOM] .
  115. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  116. non-zero, then the invalid floating-point exception shall be raised.
  117. .RE
  118. .IP "Range\ Error" 12
  119. The result overflows
  120. .RS 12
  121. .P
  122. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  123. non-zero, then
  124. .IR errno
  125. shall be set to
  126. .BR [ERANGE] .
  127. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  128. non-zero, then the overflow floating-point exception shall be raised.
  129. .RE
  130. .br
  131. .P
  132. These functions may fail if:
  133. .IP "Range\ Error" 12
  134. The result underflows,
  135. or the value of
  136. .IR x
  137. is subnormal.
  138. .RS 12
  139. .P
  140. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  141. non-zero, then
  142. .IR errno
  143. shall be set to
  144. .BR [ERANGE] .
  145. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  146. non-zero, then the underflow floating-point exception shall be raised.
  147. .RE
  148. .LP
  149. .IR "The following sections are informative."
  150. .SH EXAMPLES
  151. .SS "Taking the Tangent of a 45-Degree Angle"
  152. .sp
  153. .RS 4
  154. .nf
  155. #include <math.h>
  156. \&...
  157. double radians = 45.0 * M_PI / 180;
  158. double result;
  159. \&...
  160. result = tan (radians);
  161. .fi
  162. .P
  163. .RE
  164. .SH "APPLICATION USAGE"
  165. There are no known floating-point representations such that for a
  166. normal argument,
  167. .IR tan (\c
  168. .IR x )
  169. is either overflow or underflow.
  170. .P
  171. These functions may lose accuracy when their argument is near a
  172. multiple of \(*p/2 or is far from 0.0.
  173. .P
  174. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  175. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  176. other, but at least one of them must be non-zero.
  177. .SH RATIONALE
  178. None.
  179. .SH "FUTURE DIRECTIONS"
  180. None.
  181. .SH "SEE ALSO"
  182. .IR "\fIatan\fR\^(\|)",
  183. .IR "\fIfeclearexcept\fR\^(\|)",
  184. .IR "\fIfetestexcept\fR\^(\|)",
  185. .IR "\fIisnan\fR\^(\|)"
  186. .P
  187. The Base Definitions volume of POSIX.1\(hy2017,
  188. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  189. .IR "\fB<math.h>\fP"
  190. .\"
  191. .SH COPYRIGHT
  192. Portions of this text are reprinted and reproduced in electronic form
  193. from IEEE Std 1003.1-2017, Standard for Information Technology
  194. -- Portable Operating System Interface (POSIX), The Open Group Base
  195. Specifications Issue 7, 2018 Edition,
  196. Copyright (C) 2018 by the Institute of
  197. Electrical and Electronics Engineers, Inc and The Open Group.
  198. In the event of any discrepancy between this version and the original IEEE and
  199. The Open Group Standard, the original IEEE and The Open Group Standard
  200. is the referee document. The original Standard can be obtained online at
  201. http://www.opengroup.org/unix/online.html .
  202. .PP
  203. Any typographical or formatting errors that appear
  204. in this page are most likely
  205. to have been introduced during the conversion of the source files to
  206. man page format. To report such errors, see
  207. https://www.kernel.org/doc/man-pages/reporting_bugs.html .