home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / d / djdev108.zip / INCLUDE / MATH.H < prev    next >
C/C++ Source or Header  |  1992-03-09  |  6KB  |  233 lines

  1. /* This is file math.h */
  2. /* This file may have been modified by DJ Delorie (Jan 1991).  If so,
  3. ** these modifications are Coyright (C) 1991 DJ Delorie, 24 Kirsten Ave,
  4. ** Rochester NH, 03867-2954, USA.
  5. */
  6.  
  7. /* This may look like C code, but it is really -*- C++ -*- */
  8. /* 
  9. Copyright (C) 1988 Free Software Foundation
  10.     written by Doug Lea (dl@rocky.oswego.edu)
  11.  
  12. This file is part of GNU CC.
  13.  
  14. GNU CC is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY.  No author or distributor
  16. accepts responsibility to anyone for the consequences of using it
  17. or for whether it serves any particular purpose or works at all,
  18. unless he says so in writing.  Refer to the GNU CC General Public
  19. License for full details.
  20.  
  21. Everyone is granted permission to copy, modify and redistribute
  22. GNU CC, but only under the conditions described in the
  23. GNU CC General Public License.   A copy of this license is
  24. supposed to have been given to you along with GNU CC so you
  25. can know your rights and responsibilities.  It should be in a
  26. file named COPYING.  Among other things, the copyright notice
  27. and this notice must be preserved on all copies.  
  28. */
  29.  
  30.  
  31. #ifndef _math_h
  32. #define _math_h 1
  33.  
  34. #if defined(hp300) && defined(__HAVE_FPU__)
  35. #define __HAVE_68881__ 1
  36. #endif
  37.  
  38.  
  39. #ifdef __HAVE_68881__           /* MC68881/2 Floating-Point Coprocessor */
  40. #include <math-68881.h>
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {                    /* fill in what we've left out */
  44. #endif
  45.  
  46. double  acosh(double);
  47. double  asinh(double);
  48. double  cbrt(double);
  49. double  copysign(double,double);
  50. double  erf(double);
  51. double  erfc(double);
  52. double  finite(double);
  53. double  gamma(double);
  54. double  hypot(double,double);
  55. double  infnan(int);
  56. int     isinf(double);
  57. int     isnan(double);
  58. double  j0(double);
  59. double  j1(double);
  60. double  jn(int, double);
  61. double  lgamma(double);
  62. double  y0(double);
  63. double  y1(double);
  64. double  yn(int, double);
  65.  
  66. double aint(double);
  67. double anint(double);
  68. int irint(double);
  69. int nint(double);
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73. /* Please add inline asm code for other machines here! */
  74. #else
  75. #ifdef __cplusplus
  76. extern "C" {
  77. #endif
  78.  
  79. double  acos(double);
  80. double  acosh(double);
  81. double  asin(double);
  82. double  asinh(double);
  83. double  atan(double);
  84. double  atan2(double, double);
  85. double  atanh(double);
  86. double  cbrt(double);
  87. double  ceil(double);
  88. double  copysign(double,double);
  89. double  cos(double);
  90. double  cosh(double);
  91. double  drem(double,double);
  92. double  erf(double);
  93. double  erfc(double);
  94. double  exp(double);
  95. double  expm1(double);
  96. double  fabs(double);
  97. double  finite(double);
  98. double  floor(double);
  99. double  fmod(double,double);
  100. double  frexp(double, int*);
  101. double  gamma(double);
  102. double  hypot(double,double);
  103. double  infnan(int);
  104. #if !defined(sequent) && !defined(DGUX) /* see below */
  105. int     isinf(double);
  106. int     isnan(double);
  107. #endif
  108. double  j0(double);
  109. double  j1(double);
  110. double  jn(int, double);
  111. double  ldexp(double, int);
  112. double  lgamma(double);
  113. double  log(double);
  114. double  log10(double);
  115. double  log1p(double);
  116. double  logb(double);
  117. double  log2(double);
  118. double  modf(double, double*);
  119. double  pow(double, double);
  120. double  pow2(double);
  121. double  pow10(double);
  122. double  rint(double);
  123. double  scalb(double, int);
  124. double  sin(double);
  125. double  sinh(double);
  126. double  sqrt(double);
  127. double  tan(double);
  128. double  tanh(double);
  129. double  y0(double);
  130. double  y1(double);
  131. double  yn(int, double);
  132.  
  133. double aint(double);
  134. double anint(double);
  135. int irint(double);
  136. int nint(double);
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140.  
  141. #endif
  142.  
  143. /* libg++ doesn't use this since it is not available on some systems */
  144.  
  145. /* the following ifdef is just for compiling OOPS */
  146.  
  147. #ifndef DONT_DECLARE_EXCEPTION
  148. struct libm_exception
  149. {
  150.   int type;
  151.   char* name;
  152.   double arg1, arg2, retval;
  153. };
  154.  
  155. #define DOMAIN      1
  156. #define SING        2
  157. #define OVERFLOW    3
  158. #define UNDERFLOW   4
  159. #define TLOSS       5
  160. #define PLOSS       6
  161.  
  162. #ifdef __cplusplus
  163. extern "C" int matherr(libm_exception*);
  164. #endif
  165.  
  166. #endif
  167.  
  168. #include <values.h>
  169.  
  170. /* On some systems, HUGE ought to be MAXFLOAT or IEEE infinity */
  171.  
  172. #ifndef HUGE
  173. #define HUGE    MAXDOUBLE
  174. #endif
  175.  
  176. /* sequents don't supply these. The following should suffice */
  177. #if defined(sequent) || defined(DGUX)
  178. static inline int isnan(double x) { return x != x; }
  179. static inline int isinf(double x) { return x > MAXDOUBLE || x < -MAXDOUBLE; }
  180. #endif
  181.  
  182.  
  183. /* These seem to be sun & sysV names of these constants */
  184.  
  185. #ifndef M_E
  186. #define M_E         2.7182818284590452354
  187. #endif
  188. #ifndef M_LOG2E
  189. #define M_LOG2E     1.4426950408889634074
  190. #endif
  191. #ifndef M_LOG10E
  192. #define M_LOG10E    0.43429448190325182765
  193. #endif
  194. #ifndef M_LN2
  195. #define M_LN2       0.69314718055994530942
  196. #endif
  197. #ifndef M_LN10
  198. #define M_LN10      2.30258509299404568402
  199. #endif
  200. #ifndef M_PI
  201. #define M_PI        3.14159265358979323846
  202. #endif
  203. #ifndef M_PI_2
  204. #define M_PI_2      1.57079632679489661923
  205. #endif
  206. #ifndef M_1_PI
  207. #define M_1_PI      0.31830988618379067154
  208. #endif
  209. #ifndef M_PI_4
  210. #define M_PI_4      0.78539816339744830962
  211. #endif
  212. #ifndef M_2_PI
  213. #define M_2_PI      0.63661977236758134308
  214. #endif
  215. #ifndef M_2_SQRTPI
  216. #define M_2_SQRTPI  1.12837916709551257390
  217. #endif
  218. #ifndef M_SQRT2
  219. #define M_SQRT2     1.41421356237309504880
  220. #endif
  221. #ifndef M_SQRT1_2
  222. #define M_SQRT1_2   0.70710678118654752440
  223. #endif
  224.  
  225. #ifndef PI                      /* as in stroustrup */
  226. #define PI  M_PI
  227. #endif
  228. #ifndef PI2
  229. #define PI2  M_PI_2
  230. #endif
  231.  
  232. #endif
  233.