home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / djgpp / include / math.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-20  |  5.4 KB  |  232 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. #pragma once
  33. #define _math_h 1
  34.  
  35. #if defined(hp300) && defined(__HAVE_FPU__)
  36. #define __HAVE_68881__ 1
  37. #endif
  38.  
  39.  
  40. #ifdef __HAVE_68881__        /* MC68881/2 Floating-Point Coprocessor */
  41. #include <math-68881.h>
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {            /* fill in what we've left out */
  45. #endif
  46.  
  47. double  acosh(double);
  48. double  asinh(double);
  49. double  cbrt(double);
  50. double  copysign(double,double);
  51. double  erf(double);
  52. double  erfc(double);
  53. double  finite(double);
  54. double  gamma(double);
  55. double  hypot(double,double);
  56. double  infnan(int);
  57. int     isinf(double);
  58. int     isnan(double);
  59. double  j0(double);
  60. double  j1(double);
  61. double  jn(int, double);
  62. double  lgamma(double);
  63. double  y0(double);
  64. double  y1(double);
  65. double  yn(int, double);
  66.  
  67. double aint(double);
  68. double anint(double);
  69. int irint(double);
  70. int nint(double);
  71. #ifdef __cplusplus
  72. }
  73. #endif
  74. /* Please add inline asm code for other machines here! */
  75. #else
  76. #ifdef __cplusplus
  77. extern "C" {
  78. #endif
  79.  
  80. double  acos(double);
  81. double  acosh(double);
  82. double  asin(double);
  83. double  asinh(double);
  84. double  atan(double);
  85. double  atan2(double, double);
  86. double  atanh(double);
  87. double  cbrt(double);
  88. double  ceil(double);
  89. double  copysign(double,double);
  90. double  cos(double);
  91. double  cosh(double);
  92. double  drem(double,double);
  93. double  erf(double);
  94. double  erfc(double);
  95. double  exp(double);
  96. double  expm1(double);
  97. double  fabs(double);
  98. double  finite(double);
  99. double  floor(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  modf(double, double*);
  118. double  pow(double, double);
  119. double    pow2(double);
  120. double    pow10(double);
  121. double  rint(double);
  122. double  scalb(double, int);
  123. double  sin(double);
  124. double  sinh(double);
  125. double  sqrt(double);
  126. double  tan(double);
  127. double  tanh(double);
  128. double  y0(double);
  129. double  y1(double);
  130. double  yn(int, double);
  131.  
  132. double aint(double);
  133. double anint(double);
  134. int irint(double);
  135. int nint(double);
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139.  
  140. #endif
  141.  
  142. /* libg++ doesn't use this since it is not available on some systems */
  143.  
  144. /* the following ifdef is just for compiling OOPS */
  145.  
  146. #ifndef DONT_DECLARE_EXCEPTION
  147. struct libm_exception
  148. {
  149.   int type;
  150.   char* name;
  151.   double arg1, arg2, retval;
  152. };
  153.  
  154. #define DOMAIN      1
  155. #define SING        2
  156. #define OVERFLOW    3
  157. #define UNDERFLOW   4
  158. #define TLOSS       5
  159. #define PLOSS       6
  160.  
  161. #ifdef __cplusplus
  162. extern "C" int matherr(libm_exception*);
  163. #endif
  164.  
  165. #endif
  166.  
  167. #include <values.h>
  168.  
  169. /* On some systems, HUGE ought to be MAXFLOAT or IEEE infinity */
  170.  
  171. #ifndef HUGE
  172. #define HUGE    MAXDOUBLE
  173. #endif
  174.  
  175. /* sequents don't supply these. The following should suffice */
  176. #if defined(sequent) || defined(DGUX)
  177. static inline int isnan(double x) { return x != x; }
  178. static inline int isinf(double x) { return x > MAXDOUBLE || x < -MAXDOUBLE; }
  179. #endif
  180.  
  181.  
  182. /* These seem to be sun & sysV names of these constants */
  183.  
  184. #ifndef M_E
  185. #define M_E         2.7182818284590452354
  186. #endif
  187. #ifndef M_LOG2E
  188. #define M_LOG2E     1.4426950408889634074
  189. #endif
  190. #ifndef M_LOG10E
  191. #define M_LOG10E    0.43429448190325182765
  192. #endif
  193. #ifndef M_LN2
  194. #define M_LN2       0.69314718055994530942
  195. #endif
  196. #ifndef M_LN10
  197. #define M_LN10      2.30258509299404568402
  198. #endif
  199. #ifndef M_PI
  200. #define M_PI        3.14159265358979323846
  201. #endif
  202. #ifndef M_PI_2
  203. #define M_PI_2      1.57079632679489661923
  204. #endif
  205. #ifndef M_1_PI
  206. #define M_1_PI      0.31830988618379067154
  207. #endif
  208. #ifndef M_PI_4
  209. #define M_PI_4      0.78539816339744830962
  210. #endif
  211. #ifndef M_2_PI
  212. #define M_2_PI      0.63661977236758134308
  213. #endif
  214. #ifndef M_2_SQRTPI
  215. #define M_2_SQRTPI  1.12837916709551257390
  216. #endif
  217. #ifndef M_SQRT2
  218. #define M_SQRT2     1.41421356237309504880
  219. #endif
  220. #ifndef M_SQRT1_2
  221. #define M_SQRT1_2   0.70710678118654752440
  222. #endif
  223.  
  224. #ifndef PI                      /* as in stroustrup */
  225. #define PI  M_PI
  226. #endif
  227. #ifndef PI2
  228. #define PI2  M_PI_2
  229. #endif
  230.  
  231. #endif
  232.