home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / armlinux / alpha / PARTITIONS / USR_GZ / usr / include / math.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-14  |  8.9 KB  |  283 lines

  1. /* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3.  
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public License as
  6. published by the Free Software Foundation; either version 2 of the
  7. License, or (at your option) any later version.
  8.  
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. Library General Public License for more details.
  13.  
  14. You should have received a copy of the GNU Library General Public
  15. License along with the GNU C Library; see the file COPYING.LIB.  If
  16. not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
  17. Cambridge, MA 02139, USA.  */
  18.  
  19. /*
  20.  *      ANSI Standard: 4.5 MATHEMATICS  <math.h>
  21.  */
  22.  
  23. #ifndef    _MATH_H
  24. #define    _MATH_H
  25.  
  26. #include <features.h>
  27.  
  28. __BEGIN_DECLS
  29.  
  30. /* Trigonometric functions.  */
  31.  
  32. /* Arc cosine of X.  */
  33. extern __CONSTVALUE double acos __P ((double __x)) __CONSTVALUE2;
  34. /* Arc sine of X.  */
  35. extern __CONSTVALUE double asin __P ((double __x)) __CONSTVALUE2;
  36. /* Arc tangent of X.  */
  37. extern __CONSTVALUE double atan __P ((double __x)) __CONSTVALUE2;
  38. /* Arc tangent of Y/X.  */
  39. extern __CONSTVALUE double atan2 __P ((double __y, double __x)) __CONSTVALUE2;
  40.  
  41. /* Cosine of X.  */
  42. extern __CONSTVALUE double cos __P ((double __x)) __CONSTVALUE2;
  43. /* Sine of X.  */
  44. extern __CONSTVALUE double sin __P ((double __x)) __CONSTVALUE2;
  45. /* Tangent of X.  */
  46. extern __CONSTVALUE double tan __P ((double __x)) __CONSTVALUE2;
  47.  
  48.  
  49. /* Hyperbolic functions.  */
  50.  
  51. /* Hyperbolic cosine of X.  */
  52. extern __CONSTVALUE double cosh __P ((double __x)) __CONSTVALUE2;
  53. /* Hyperbolic sine of X.  */
  54. extern __CONSTVALUE double sinh __P ((double __x)) __CONSTVALUE2;
  55. /* Hyperbolic tangent of X.  */
  56. extern __CONSTVALUE double tanh __P ((double __x)) __CONSTVALUE2;
  57.  
  58. /* Hyperbolic arc cosine of X.  */
  59. extern __CONSTVALUE double acosh __P ((double __x)) __CONSTVALUE2;
  60. /* Hyperbolic arc sine of X.  */
  61. extern __CONSTVALUE double asinh __P ((double __x)) __CONSTVALUE2;
  62. /* Hyperbolic arc tangent of X.  */
  63. extern __CONSTVALUE double atanh __P ((double __x)) __CONSTVALUE2;
  64.  
  65. /* Exponential and logarithmic functions.  */
  66.  
  67. /* Exponentional function of X.  */
  68. extern __CONSTVALUE double exp __P ((double __x)) __CONSTVALUE2;
  69.  
  70. /* Break VALUE into a normalized fraction and an integral power of 2.  */
  71. extern              double frexp __P ((double __x, int *__exp));
  72.  
  73. /* X times (two to the EXP power).  */
  74. extern __CONSTVALUE double ldexp __P ((double __x, int __exp)) __CONSTVALUE2;
  75.  
  76. /* Natural logarithm of X.  */
  77. extern __CONSTVALUE double log __P ((double __x)) __CONSTVALUE2;
  78.  
  79. /* Base-ten logarithm of X.  */
  80. extern __CONSTVALUE double log10 __P ((double __x)) __CONSTVALUE2;
  81.  
  82. /* Return exp(X) - 1.  */
  83. extern __CONSTVALUE double expm1 __P ((double __x)) __CONSTVALUE2;
  84.  
  85. /* Return log(1 + X).  */
  86. extern __CONSTVALUE double log1p __P ((double __x)) __CONSTVALUE2;
  87.  
  88. /* Break VALUE into integral and fractional parts.  */
  89. extern              double modf __P ((double __x, double *__iptr));
  90.  
  91.  
  92. /* Power functions.  */
  93.  
  94. /* Return X to the Y power.  */
  95. extern __CONSTVALUE double pow __P ((double __x, double __y)) __CONSTVALUE2;
  96.  
  97. /* Return the square root of X.  */
  98. extern __CONSTVALUE double sqrt __P ((double __x)) __CONSTVALUE2;
  99.  
  100. /* Return the cube root of X.  */
  101. extern __CONSTVALUE double cbrt  __P ((double __x)) __CONSTVALUE2;
  102.  
  103.  
  104. /* Nearest integer, absolute value, and remainder functions.  */
  105.  
  106. /* Smallest integral value not less than X.  */
  107. extern __CONSTVALUE double ceil __P ((double __x)) __CONSTVALUE2;
  108.  
  109. /* Absolute value of X.  */
  110. extern __CONSTVALUE double fabs __P ((double __x)) __CONSTVALUE2;
  111.  
  112. /* Largest integer not greater than X.  */
  113. extern __CONSTVALUE double floor __P ((double __x)) __CONSTVALUE2;
  114.  
  115. /* Floating-point modulo remainder of X/Y.  */
  116. extern __CONSTVALUE double fmod __P ((double __x, double __y)) __CONSTVALUE2;
  117.  
  118.  
  119. /* Return 0 if VALUE is finite or NaN, +1 if it
  120.    is +Infinity, -1 if it is -Infinity.  */
  121. extern __CONSTVALUE int __isinf __P ((double __value)) __CONSTVALUE2;
  122.  
  123. /* Return nonzero if VALUE is not a number.  */
  124. extern __CONSTVALUE int __isnan __P ((double __value)) __CONSTVALUE2;
  125.  
  126. /* Return nonzero if VALUE is finite and not NaN.  */
  127. extern __CONSTVALUE int __finite __P ((double __value)) __CONSTVALUE2;
  128. #ifdef    __OPTIMIZE__
  129. #define    __finite(value)    (!__isinf (value) && !__isnan (value))
  130. #endif
  131.  
  132. /* Deal with an infinite or NaN result.
  133.    If ERROR is ERANGE, result is +Inf;
  134.    if ERROR is - ERANGE, result is -Inf;
  135.    otherwise result is NaN.
  136.    This will set `errno' to either ERANGE or EDOM,
  137.    and may return an infinity or NaN, or may do something else.  */
  138. extern double __infnan __P ((int __error));
  139.  
  140. /* Return X with its signed changed to Y's.  */
  141. extern __CONSTVALUE double __copysign __P ((double __x,
  142.                         double __y)) __CONSTVALUE2;
  143.  
  144. /* Return the integer nearest X in the direction of the
  145.    prevailing rounding mode.  */
  146. extern __CONSTVALUE double __rint __P ((double __x)) __CONSTVALUE2;
  147. extern __CONSTVALUE double rint __P ((double __x)) __CONSTVALUE2;
  148.  
  149. /* Return `sqrt(X*X + Y*Y)'.  */
  150. extern __CONSTVALUE double hypot __P ((double __x, double __y)) __CONSTVALUE2;
  151.  
  152. #ifdef    __USE_MISC
  153.  
  154. extern __CONSTVALUE int isinf __P ((double __value)) __CONSTVALUE2;
  155. extern __CONSTVALUE int isnan __P ((double __value)) __CONSTVALUE2;
  156. extern __CONSTVALUE int finite __P ((double __value)) __CONSTVALUE2;
  157. extern __CONSTVALUE double infnan __P ((int __error)) __CONSTVALUE2;
  158. extern __CONSTVALUE double copysign __P ((double __x,
  159.                       double __y)) __CONSTVALUE2;
  160. extern __CONSTVALUE double drem __P ((double __x, double __y)) __CONSTVALUE2;
  161.  
  162. #ifdef    __OPTIMIZE__
  163. #define    isinf(value)    __isinf(value)
  164. #define    isnan(value)    __isnan(value)
  165. #define    infnan(error)    __infnan(error)
  166. #define    finite(value)    __finite(value)
  167. #define    copysign(x, y)    __copysign((x), (y))
  168. #endif /* Optimizing.  */
  169.  
  170. #endif /* Use misc.  */
  171.  
  172.  
  173. /* some other functions not in GNU libc */
  174.  
  175. /* Return 2 to the X power.  */
  176. extern __CONSTVALUE double pow2 __P ((double __x)) __CONSTVALUE2;
  177.  
  178. /* Return 10 to the X power.  */
  179. extern __CONSTVALUE double pow10 __P ((double __x)) __CONSTVALUE2;
  180.  
  181. /* Return the error function of X. */
  182. extern __CONSTVALUE double erf  __P ((double __x)) __CONSTVALUE2;
  183.  
  184. /* Return the complementary error function of X.  */
  185. extern __CONSTVALUE double erfc  __P ((double __x)) __CONSTVALUE2;
  186.  
  187. /* Return the Bessel function of X of the first kind of order 0.  */
  188. extern __CONSTVALUE double j0  __P ((double __x)) __CONSTVALUE2;
  189.  
  190. /* Return the Bessel function of X of the first kind of order 1.  */
  191. extern __CONSTVALUE double j1  __P ((double __x)) __CONSTVALUE2;
  192.  
  193. /* Return the Bessel function of X of the first kind of order N.  */
  194. extern __CONSTVALUE double jn  __P ((int __n, double __x)) __CONSTVALUE2;
  195.  
  196. /* Return the log of the absolute value of the Gamma function of X.  */
  197. extern __CONSTVALUE double lgamma  __P ((double __x)) __CONSTVALUE2;
  198.  
  199. /* Return the Bessel function of X of the second kind of order 0.  */
  200. extern __CONSTVALUE double y0  __P ((double __x)) __CONSTVALUE2;
  201.  
  202. /* Return the Bessel function of X of the second kind of order 1.  */
  203. extern __CONSTVALUE double y1  __P ((double __x)) __CONSTVALUE2;
  204.  
  205. /* Return the Bessel function of X of the second kind of order N.  */
  206. extern __CONSTVALUE double yn  __P ((int __n, double __x)) __CONSTVALUE2;
  207.  
  208. __END_DECLS
  209.  
  210. extern int signgam;
  211.  
  212. /* Get machine-dependent HUGE_VAL value (returned on overflow).  */
  213. #include <huge_val.h>
  214.  
  215. /* Get machine-dependent NAN value (returned for some domain errors).  */
  216. #ifdef   __USE_GNU
  217. #include <nan.h>
  218. #endif
  219.  
  220. #include <float.h>
  221. #include <values.h>
  222.  
  223. #ifndef HUGE
  224. #define HUGE        DBL_MAX
  225. #endif
  226.  
  227. #ifndef HUGE_VAL
  228. #define HUGE_VAL    DBL_MAX
  229. #endif
  230.  
  231. #ifndef M_E
  232. #define M_E         2.7182818284590452354    /* e */
  233. #endif
  234. #ifndef M_LOG2E
  235. #define M_LOG2E     1.4426950408889634074    /* log 2e */
  236. #endif
  237. #ifndef M_LOG10E
  238. #define M_LOG10E    0.43429448190325182765    /* log 10e */
  239. #endif
  240. #ifndef M_LN2
  241. #define M_LN2       0.69314718055994530942    /* log e2 */
  242. #endif
  243. #ifndef M_LN10
  244. #define M_LN10      2.30258509299404568402    /* log e10 */
  245. #endif
  246. #ifndef M_PI
  247. #define M_PI        3.14159265358979323846    /* pi */
  248. #endif
  249. #ifndef M_PI_2
  250. #define M_PI_2      1.57079632679489661923    /* pi/2 */
  251. #endif
  252. #ifndef M_1_PI
  253. #define M_1_PI      0.31830988618379067154    /* 1/pi */
  254. #endif
  255. #ifndef M_PI_4
  256. #define M_PI_4      0.78539816339744830962    /* pi/4 */
  257. #endif
  258. #ifndef M_2_PI
  259. #define M_2_PI      0.63661977236758134308    /* 2/pi */
  260. #endif
  261. #ifndef M_2_SQRTPI
  262. #define M_2_SQRTPI  1.12837916709551257390    /* 2/sqrt(pi) */
  263. #endif
  264. #ifndef M_SQRT2
  265. #define M_SQRT2     1.41421356237309504880    /* sqrt(2) */
  266. #endif
  267. #ifndef M_SQRT1_2
  268. #define M_SQRT1_2   0.70710678118654752440    /* 1/sqrt(2) */
  269. #endif
  270.  
  271. #ifndef PI                      /* as in stroustrup */
  272. #define PI  M_PI
  273. #endif
  274. #ifndef PI2
  275. #define PI2  M_PI_2
  276. #endif
  277.  
  278. #if defined(__mc68000__)
  279. # include <m68k/__math.h>
  280. #endif
  281.  
  282. #endif /* _MATH_H */
  283.