home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c083 / 14.ddi / GENINC.PAK / MATH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-02  |  10.9 KB  |  310 lines

  1. /*  math.h
  2.  
  3.     Definitions for the math floating point package.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 6.0
  9.  *
  10.  *      Copyright (c) 1987, 1993 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14.  
  15. #ifndef  __MATH_H
  16. #define  __MATH_H
  17.  
  18. #if !defined(___DEFS_H)
  19. #include <_defs.h>
  20. #endif
  21.  
  22. #if !defined(_RC_INVOKED)
  23. #pragma option -a-
  24. #endif
  25.  
  26. #if !defined(__STDC__) /* NON-ANSI */
  27.  
  28. #ifdef __cplusplus
  29.     /* use class complex instead of _cabs in C++ */
  30. #else
  31. struct complex      /* as used by "_cabs" function */
  32. {
  33.     double  x, y;
  34. };
  35.  
  36. struct _complexl    /* as used by "_cabsl" function */
  37. {
  38.     long double  x, y;
  39. };
  40.  
  41. #define cabs(z)     (hypot  ((z).x, (z).y))
  42. #define cabsl(z)    (hypotl ((z).x, (z).y))
  43. #endif /* NON-ANSI */
  44.  
  45. #endif
  46.  
  47. typedef enum
  48. {
  49.     DOMAIN = 1,    /* argument domain error -- log (-1)        */
  50.     SING,          /* argument singularity  -- pow (0,-2))     */
  51.     OVERFLOW,      /* overflow range error  -- exp (1000)      */
  52.     UNDERFLOW,     /* underflow range error -- exp (-1000)     */
  53.     TLOSS,         /* total loss of significance -- sin(10e70) */
  54.     PLOSS,         /* partial loss of signif. -- not used      */
  55.     STACKFAULT     /* floating point unit stack overflow       */
  56. }   _mexcep;
  57.  
  58. /* Constants rounded for 21 decimals. */
  59. #define M_E         2.71828182845904523536
  60. #define M_LOG2E     1.44269504088896340736
  61. #define M_LOG10E    0.434294481903251827651
  62. #define M_LN2       0.693147180559945309417
  63. #define M_LN10      2.30258509299404568402
  64. #define M_PI        3.14159265358979323846
  65. #define M_PI_2      1.57079632679489661923
  66. #define M_PI_4      0.785398163397448309616
  67. #define M_1_PI      0.318309886183790671538
  68. #define M_2_PI      0.636619772367581343076
  69. #define M_1_SQRTPI  0.564189583547756286948
  70. #define M_2_SQRTPI  1.12837916709551257390
  71. #define M_SQRT2     1.41421356237309504880
  72. #define M_SQRT_2    0.707106781186547524401
  73.  
  74. #define EDOM    33      /* Math argument */
  75. #define ERANGE  34      /* Result too large */
  76.  
  77. struct  exception
  78. {
  79.     int type;
  80.     char   _FAR *name;
  81.     double  arg1, arg2, retval;
  82. };
  83.  
  84. struct  _exceptionl
  85. {
  86.     int type;
  87.     char   _FAR *name;
  88.     long double  arg1, arg2, retval;
  89. };
  90.  
  91. #if !defined(__FLAT__)
  92.  
  93. #define HUGE_VAL    _huge_dble
  94. extern double _RTLENTRY _huge_dble;
  95. #define _LHUGE_VAL   _huge_ldble
  96. extern long double _RTLENTRY _huge_ldble;
  97.  
  98. #ifdef __cplusplus
  99. extern "C" {
  100. #endif
  101. double      _RTLENTRY _EXPFUNC acos    (double __x);
  102. double      _RTLENTRY _EXPFUNC asin    (double __x);
  103. double      _RTLENTRY          atan    (double __x);
  104. double      _RTLENTRY _EXPFUNC atan2   (double __y, double __x);
  105. double      _RTLENTRY _EXPFUNC ceil    (double __x);
  106. double      _RTLENTRY _EXPFUNC cos     (double __x);
  107. double      _RTLENTRY _EXPFUNC cosh    (double __x);
  108. double      _RTLENTRY _EXPFUNC exp     (double __x);
  109. double      _RTLENTRY          fabs    (double __x);
  110. double      _RTLENTRY          __fabs__(double __x); /* Intrinsic */
  111. double      _RTLENTRY _EXPFUNC floor   (double __x);
  112. double      _RTLENTRY _EXPFUNC fmod    (double __x, double __y);
  113. double      _RTLENTRY _EXPFUNC frexp   (double __x, int _FAR *__exponent);
  114. double      _RTLENTRY _EXPFUNC ldexp   (double __x, int __exponent);
  115. double      _RTLENTRY _EXPFUNC log     (double __x);
  116. double      _RTLENTRY _EXPFUNC log10   (double __x);
  117. double      _RTLENTRY _EXPFUNC modf    (double __x, double _FAR *__ipart);
  118. double      _RTLENTRY _EXPFUNC pow     (double __x, double __y);
  119. double      _RTLENTRY _EXPFUNC sin     (double __x);
  120. double      _RTLENTRY _EXPFUNC sinh    (double __x);
  121. double      _RTLENTRY _EXPFUNC sqrt    (double __x);
  122. double      _RTLENTRY _EXPFUNC tan     (double __x);
  123. double      _RTLENTRY _EXPFUNC tanh    (double __x);
  124.  
  125. long double _RTLENTRY _EXPFUNC acosl  (long double __x);
  126. long double _RTLENTRY _EXPFUNC asinl  (long double __x);
  127. long double _RTLENTRY _EXPFUNC atan2l (long double __x, long double __y);
  128. long double _RTLENTRY          atanl  (long double __x);
  129. long double _RTLENTRY _EXPFUNC ceill  (long double __x);
  130. long double _RTLENTRY _EXPFUNC coshl  (long double __x);
  131. long double _RTLENTRY _EXPFUNC cosl   (long double __x);
  132. long double _RTLENTRY _EXPFUNC expl   (long double __x);
  133. long double _RTLENTRY          fabsl  (long double __x);
  134. long double _RTLENTRY _EXPFUNC floorl (long double __x);
  135. long double _RTLENTRY _EXPFUNC fmodl  (long double __x, long double __y);
  136. long double _RTLENTRY _EXPFUNC frexpl (long double __x, int _FAR *__exponent);
  137. long double _RTLENTRY _EXPFUNC ldexpl (long double __x, int __exponent);
  138. long double _RTLENTRY _EXPFUNC log10l (long double __x);
  139. long double _RTLENTRY _EXPFUNC logl   (long double __x);
  140. long double _RTLENTRY _EXPFUNC modfl  (long double __x, long double _FAR *__ipart);
  141. long double _RTLENTRY _EXPFUNC powl   (long double __x, long double __y);
  142. long double _RTLENTRY _EXPFUNC sinhl  (long double __x);
  143. long double _RTLENTRY _EXPFUNC sinl   (long double __x);
  144. long double _RTLENTRY _EXPFUNC sqrtl  (long double __x);
  145. long double _RTLENTRY _EXPFUNC tanhl  (long double __x);
  146. long double _RTLENTRY _EXPFUNC tanl   (long double __x);
  147.  
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151.  
  152.  
  153. #if !__STDC__
  154.  
  155. #ifdef __cplusplus
  156. extern "C" {
  157. #endif
  158.  
  159. double      _RTLENTRY _EXPFUNC hypot (double __x, double __y);
  160. int         _RTLENTRY _EXPFUNC _matherr (struct exception _FAR *__e);
  161. double      _RTLENTRY _EXPFUNC poly  (double __x, int __degree, double _FAR *__coeffs);
  162. double      _RTLENTRY _EXPFUNC pow10 (int __p);
  163. long double _RTLENTRY _EXPFUNC hypotl (long double __x, long double __y);
  164. long double _RTLENTRY _EXPFUNC polyl  (long double __x, int __degree, long double _FAR *__coeffs);
  165. long double _RTLENTRY _EXPFUNC pow10l (int __p);
  166.  
  167. #if !defined(__ABS_DEFINED)
  168. #define __ABS_DEFINED
  169. int         _RTLENTRY __abs__(int);
  170. #ifdef __cplusplus
  171. inline int _RTLENTRY  abs(int __x) { return __abs__(__x); }
  172. #else
  173. int         _RTLENTRY abs(int __x);
  174. #  define abs(x)   __abs__(x)
  175. #endif
  176.  
  177. #endif /* __ABS_DEFINED */
  178.  
  179. double      _RTLENTRY          atof  (const char _FAR *__s);
  180. long        _RTLENTRY          labs  (long __x);
  181. int         _RTLENTRY _EXPFUNC _matherrl (struct _exceptionl _FAR *__e);
  182.  
  183. long double _RTLENTRY          _atold (const char _FAR *__s);
  184.  
  185. long double _RTLENTRY _EXPFUNC hypotl (long double __x, long double __y);
  186. long double _RTLENTRY _EXPFUNC polyl  (long double __x, int __degree, long double _FAR *__coeffs);
  187. long double _RTLENTRY _EXPFUNC pow10l (int __p);
  188.  
  189. #ifdef __cplusplus
  190. }
  191. #endif
  192.  
  193. #endif  /* !__STDC__ */
  194.  
  195. #else   /* defined __FLAT__ */
  196.  
  197. #define HUGE_VAL    _huge_dble
  198. extern double _RTLENTRY _EXPDATA _huge_dble;
  199. #define _LHUGE_VAL   _huge_ldble
  200. extern long double _RTLENTRY _EXPDATA _huge_ldble;
  201.  
  202. #ifdef __cplusplus
  203. extern "C" {
  204. #endif
  205. double      _RTLENTRY _EXPFUNC acos    (double __x);
  206. double      _RTLENTRY _EXPFUNC asin    (double __x);
  207. double      _RTLENTRY _EXPFUNC atan    (double __x);
  208. double      _RTLENTRY _EXPFUNC atan2   (double __y, double __x);
  209. double      _RTLENTRY _EXPFUNC ceil    (double __x);
  210. double      _RTLENTRY _EXPFUNC cos     (double __x);
  211. double      _RTLENTRY _EXPFUNC cosh    (double __x);
  212. double      _RTLENTRY _EXPFUNC exp     (double __x);
  213. double      _RTLENTRY _EXPFUNC fabs    (double __x);
  214. double      _RTLENTRY _EXPFUNC floor   (double __x);
  215. double      _RTLENTRY _EXPFUNC fmod    (double __x, double __y);
  216. double      _RTLENTRY _EXPFUNC frexp   (double __x, int * __exponent);
  217. double      _RTLENTRY _EXPFUNC ldexp   (double __x, int __exponent);
  218. double      _RTLENTRY _EXPFUNC log     (double __x);
  219. double      _RTLENTRY _EXPFUNC log10   (double __x);
  220. double      _RTLENTRY _EXPFUNC modf    (double __x, double * __ipart);
  221. double      _RTLENTRY _EXPFUNC pow     (double __x, double __y);
  222. double      _RTLENTRY _EXPFUNC sin     (double __x);
  223. double      _RTLENTRY _EXPFUNC sinh    (double __x);
  224. double      _RTLENTRY _EXPFUNC sqrt    (double __x);
  225. double      _RTLENTRY _EXPFUNC tan     (double __x);
  226. double      _RTLENTRY _EXPFUNC tanh    (double __x);
  227.  
  228. long double _RTLENTRY _EXPFUNC acosl  (long double __x);
  229. long double _RTLENTRY _EXPFUNC asinl  (long double __x);
  230. long double _RTLENTRY _EXPFUNC atan2l (long double __x, long double __y);
  231. long double _RTLENTRY _EXPFUNC atanl  (long double __x);
  232. long double _RTLENTRY _EXPFUNC ceill  (long double __x);
  233. long double _RTLENTRY _EXPFUNC coshl  (long double __x);
  234. long double _RTLENTRY _EXPFUNC cosl   (long double __x);
  235. long double _RTLENTRY _EXPFUNC expl   (long double __x);
  236. long double _RTLENTRY _EXPFUNC fabsl  (long double __x);
  237. long double _RTLENTRY _EXPFUNC floorl (long double __x);
  238. long double _RTLENTRY _EXPFUNC fmodl  (long double __x, long double __y);
  239. long double _RTLENTRY _EXPFUNC frexpl (long double __x, int * __exponent);
  240. long double _RTLENTRY _EXPFUNC ldexpl (long double __x, int __exponent);
  241. long double _RTLENTRY _EXPFUNC log10l (long double __x);
  242. long double _RTLENTRY _EXPFUNC logl   (long double __x);
  243. long double _RTLENTRY _EXPFUNC modfl  (long double __x, long double * __ipart);
  244. long double _RTLENTRY _EXPFUNC powl   (long double __x, long double __y);
  245. long double _RTLENTRY _EXPFUNC sinhl  (long double __x);
  246. long double _RTLENTRY _EXPFUNC sinl   (long double __x);
  247. long double _RTLENTRY _EXPFUNC sqrtl  (long double __x);
  248. long double _RTLENTRY _EXPFUNC tanhl  (long double __x);
  249. long double _RTLENTRY _EXPFUNC tanl   (long double __x);
  250.  
  251. /* Intrinsic functions */
  252.  
  253. double      _RTLENTRY _EXPFUNC __sin__ (double __x);
  254. double      _RTLENTRY _EXPFUNC __cos__ (double __x);
  255. long double _RTLENTRY _EXPFUNC __cosl__(long double __x);
  256. long double _RTLENTRY _EXPFUNC __sinl__(long double __x);
  257.  
  258. #ifdef __cplusplus
  259. }
  260. #endif
  261.  
  262.  
  263. #if !defined(__STDC__) /* NON_ANSI */
  264.  
  265. #ifdef __cplusplus
  266. extern "C" {
  267. #endif
  268.  
  269. #if !defined(__ABS_DEFINED)
  270. #define __ABS_DEFINED
  271. int         _RTLENTRY __abs__(int);
  272. #ifdef __cplusplus
  273. inline int _RTLENTRY  abs(int __x) { return __abs__(__x); }
  274. #else
  275. int         _RTLENTRYF _EXPFUNC abs(int __x);
  276. #  define abs(x)   __abs__(x)
  277. #endif
  278. #endif /* __ABS_DEFINED */
  279.  
  280. double      _RTLENTRY _EXPFUNC atof    (const char * __s);
  281. long        _RTLENTRY _EXPFUNC labs    (long __x);
  282. double      _RTLENTRY _EXPFUNC pow10   (int __p);
  283.  
  284. long double _RTLENTRY _EXPFUNC _atold  (const char * __s);
  285.  
  286. int         _RTLENTRY          _matherr(struct exception  *__e);
  287. int         _RTLENTRY          _matherrl(struct _exceptionl *__e);
  288.  
  289. double      _RTLENTRY _EXPFUNC hypot   (double __x, double __y);
  290. double      _RTLENTRY _EXPFUNC poly    (double __x, int __degree, double coeffs []);
  291. long double _RTLENTRY _EXPFUNC hypotl  (long double __x, long double __y);
  292. long double _RTLENTRY _EXPFUNC polyl   (long double __x, int __degree, long double coeffs []);
  293. long double _RTLENTRY _EXPFUNC pow10l  (int __p);
  294.  
  295.  
  296. #ifdef __cplusplus
  297. }
  298. #endif
  299.  
  300. #endif  /* !__STDC__ */
  301.  
  302. #endif  /* __FLAT__ */
  303.  
  304. #pragma option -a. /* restore default packing */
  305.  
  306. #endif  /* __MATH_H */
  307.  
  308.  
  309.  
  310.