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

cos.3p (3647B)


  1. '\" et
  2. .TH COS "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. cos,
  12. cosf,
  13. cosl
  14. \(em cosine function
  15. .SH SYNOPSIS
  16. .LP
  17. .nf
  18. #include <math.h>
  19. .P
  20. double cos(double \fIx\fP);
  21. float cosf(float \fIx\fP);
  22. long double cosl(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 cosine 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 cosine of
  43. .IR x .
  44. .P
  45. If
  46. .IR x
  47. is NaN, a NaN shall be returned.
  48. .P
  49. If
  50. .IR x
  51. is \(+-0, the value 1.0 shall be returned.
  52. .P
  53. If
  54. .IR x
  55. is \(+-Inf, a domain error shall occur, and a NaN shall be returned.
  56. .SH ERRORS
  57. These functions shall fail if:
  58. .IP "Domain\ Error" 12
  59. The
  60. .IR x
  61. argument is \(+-Inf.
  62. .RS 12
  63. .P
  64. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  65. non-zero, then
  66. .IR errno
  67. shall be set to
  68. .BR [EDOM] .
  69. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  70. non-zero, then the invalid floating-point exception shall be raised.
  71. .RE
  72. .LP
  73. .IR "The following sections are informative."
  74. .SH EXAMPLES
  75. .SS "Taking the Cosine of a 45-Degree Angle"
  76. .sp
  77. .RS 4
  78. .nf
  79. #include <math.h>
  80. \&...
  81. double radians = 45 * M_PI / 180;
  82. double result;
  83. \&...
  84. result = cos(radians);
  85. .fi
  86. .P
  87. .RE
  88. .SH "APPLICATION USAGE"
  89. These functions may lose accuracy when their argument is near an odd
  90. multiple of \(*p/2 or is far from 0.
  91. .P
  92. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  93. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  94. other, but at least one of them must be non-zero.
  95. .SH RATIONALE
  96. None.
  97. .SH "FUTURE DIRECTIONS"
  98. None.
  99. .SH "SEE ALSO"
  100. .IR "\fIacos\fR\^(\|)",
  101. .IR "\fIfeclearexcept\fR\^(\|)",
  102. .IR "\fIfetestexcept\fR\^(\|)",
  103. .IR "\fIisnan\fR\^(\|)",
  104. .IR "\fIsin\fR\^(\|)",
  105. .IR "\fItan\fR\^(\|)"
  106. .P
  107. The Base Definitions volume of POSIX.1\(hy2017,
  108. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  109. .IR "\fB<math.h>\fP"
  110. .\"
  111. .SH COPYRIGHT
  112. Portions of this text are reprinted and reproduced in electronic form
  113. from IEEE Std 1003.1-2017, Standard for Information Technology
  114. -- Portable Operating System Interface (POSIX), The Open Group Base
  115. Specifications Issue 7, 2018 Edition,
  116. Copyright (C) 2018 by the Institute of
  117. Electrical and Electronics Engineers, Inc and The Open Group.
  118. In the event of any discrepancy between this version and the original IEEE and
  119. The Open Group Standard, the original IEEE and The Open Group Standard
  120. is the referee document. The original Standard can be obtained online at
  121. http://www.opengroup.org/unix/online.html .
  122. .PP
  123. Any typographical or formatting errors that appear
  124. in this page are most likely
  125. to have been introduced during the conversion of the source files to
  126. man page format. To report such errors, see
  127. https://www.kernel.org/doc/man-pages/reporting_bugs.html .