math.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #ifndef __MATH
  10. #define __MATH
  11. #pragma lib "/$M/lib/ape/libap.a"
  12. /* a HUGE_VAL appropriate for IEEE double-precision */
  13. /* the correct value, 1.797693134862316e+308, causes a ken overflow */
  14. #define HUGE_VAL 1.79769313486231e+308
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. extern double acos(double);
  19. extern double asin(double);
  20. extern double atan(double);
  21. extern double atan2(double, double);
  22. extern double cos(double);
  23. extern double hypot(double, double);
  24. extern double sin(double);
  25. extern double tan(double);
  26. extern double cosh(double);
  27. extern double sinh(double);
  28. extern double tanh(double);
  29. extern double exp(double);
  30. extern double frexp(double, int *);
  31. extern double ldexp(double, int);
  32. extern double log(double);
  33. extern double log10(double);
  34. extern double modf(double, double *);
  35. extern double pow(double, double);
  36. extern double sqrt(double);
  37. extern double ceil(double);
  38. extern double fabs(double);
  39. extern double floor(double);
  40. extern double fmod(double, double);
  41. extern double NaN(void);
  42. extern int isNaN(double);
  43. extern double Inf(int);
  44. extern int isInf(double, int);
  45. #ifdef _RESEARCH_SOURCE
  46. /* does >> treat left operand as unsigned ? */
  47. #define Unsigned_Shifts 1
  48. #define M_E 2.7182818284590452354 /* e */
  49. #define M_LOG2E 1.4426950408889634074 /* log 2e */
  50. #define M_LOG10E 0.43429448190325182765 /* log 10e */
  51. #define M_LN2 0.69314718055994530942 /* log e2 */
  52. #define M_LN10 2.30258509299404568402 /* log e10 */
  53. #define M_PI 3.14159265358979323846 /* pi */
  54. #define M_PI_2 1.57079632679489661923 /* pi/2 */
  55. #define M_PI_4 0.78539816339744830962 /* pi/4 */
  56. #define M_1_PI 0.31830988618379067154 /* 1/pi */
  57. #define M_2_PI 0.63661977236758134308 /* 2/pi */
  58. #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
  59. #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
  60. #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
  61. extern double hypot(double, double);
  62. extern double erf(double);
  63. extern double erfc(double);
  64. extern double j0(double);
  65. extern double y0(double);
  66. extern double j1(double);
  67. extern double y1(double);
  68. extern double jn(int, double);
  69. extern double yn(int, double);
  70. #endif
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. #define isnan(x) isNaN(x)
  75. #define isinf(x) isInf(x, 0)
  76. #endif /* __MATH */