home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / borhead.zip / MATH.H < prev    next >
C/C++ Source or Header  |  1994-11-09  |  7KB  |  222 lines

  1. /*  math.h
  2.  
  3.     Definitions for the math floating point package.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 1.5
  9.  *
  10.  *      Copyright (c) 1987, 1994 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.  
  23. #if !defined(RC_INVOKED)
  24.  
  25. #if defined(__STDC__)
  26. #pragma warn -nak
  27. #endif
  28.  
  29. #pragma option -a-
  30.  
  31. #endif  /* !RC_INVOKED */
  32.  
  33.  
  34. #if !defined(__STDC__) /* NON-ANSI */
  35.  
  36. #ifdef __cplusplus
  37.     /* use class complex instead of _cabs in C++ */
  38. #else
  39. struct complex      /* as used by "_cabs" function */
  40. {
  41.     double  x, y;
  42. };
  43.  
  44. struct _complexl    /* as used by "_cabsl" function */
  45. {
  46.     long double  x, y;
  47. };
  48.  
  49. #define cabs(z)     (hypot  ((z).x, (z).y))
  50. #define cabsl(z)    (hypotl ((z).x, (z).y))
  51. #endif /* NON-ANSI */
  52.  
  53. #endif
  54.  
  55. typedef enum
  56. {
  57.     DOMAIN = 1,    /* argument domain error -- log (-1)        */
  58.     SING,          /* argument singularity  -- pow (0,-2))     */
  59.     OVERFLOW,      /* overflow range error  -- exp (1000)      */
  60.     UNDERFLOW,     /* underflow range error -- exp (-1000)     */
  61.     TLOSS,         /* total loss of significance -- sin(10e70) */
  62.     PLOSS,         /* partial loss of signif. -- not used      */
  63.     STACKFAULT     /* floating point unit stack overflow       */
  64. }   _mexcep;
  65.  
  66. /* Constants rounded for 21 decimals. */
  67. #define M_E         2.71828182845904523536
  68. #define M_LOG2E     1.44269504088896340736
  69. #define M_LOG10E    0.434294481903251827651
  70. #define M_LN2       0.693147180559945309417
  71. #define M_LN10      2.30258509299404568402
  72. #define M_PI        3.14159265358979323846
  73. #define M_PI_2      1.57079632679489661923
  74. #define M_PI_4      0.785398163397448309616
  75. #define M_1_PI      0.318309886183790671538
  76. #define M_2_PI      0.636619772367581343076
  77. #define M_1_SQRTPI  0.564189583547756286948
  78. #define M_2_SQRTPI  1.12837916709551257390
  79. #define M_SQRT2     1.41421356237309504880
  80. #define M_SQRT_2    0.707106781186547524401
  81.  
  82. #define EDOM    33      /* Math argument */
  83. #define ERANGE  34      /* Result too large */
  84.  
  85. struct  exception
  86. {
  87.     int type;
  88.     char   _FAR *name;
  89.     double  arg1, arg2, retval;
  90. };
  91.  
  92. struct  _exceptionl
  93. {
  94.     int type;
  95.     char   _FAR *name;
  96.     long double  arg1, arg2, retval;
  97. };
  98.  
  99.  
  100. #define HUGE_VAL    _huge_dble
  101. extern double _RTLENTRY _EXPDATA _huge_dble;
  102. #define _LHUGE_VAL   _huge_ldble
  103. extern long double _RTLENTRY _EXPDATA _huge_ldble;
  104.  
  105. #ifdef __cplusplus
  106. extern "C" {
  107. #endif
  108. double      _RTLENTRY _EXPFUNC acos    (double __x);
  109. double      _RTLENTRY _EXPFUNC asin    (double __x);
  110. double      _RTLENTRY _EXPFUNC atan    (double __x);
  111. double      _RTLENTRY _EXPFUNC atan2   (double __y, double __x);
  112. double      _RTLENTRY _EXPFUNC ceil    (double __x);
  113. double      _RTLENTRY _EXPFUNC cos     (double __x);
  114. double      _RTLENTRY _EXPFUNC cosh    (double __x);
  115. double      _RTLENTRY _EXPFUNC exp     (double __x);
  116. double      _RTLENTRY _EXPFUNC fabs    (double __x);
  117. double      _RTLENTRY _EXPFUNC floor   (double __x);
  118. double      _RTLENTRY _EXPFUNC fmod    (double __x, double __y);
  119. double      _RTLENTRY _EXPFUNC frexp   (double __x, int * __exponent);
  120. double      _RTLENTRY _EXPFUNC ldexp   (double __x, int __exponent);
  121. double      _RTLENTRY _EXPFUNC log     (double __x);
  122. double      _RTLENTRY _EXPFUNC log10   (double __x);
  123. double      _RTLENTRY _EXPFUNC modf    (double __x, double * __ipart);
  124. double      _RTLENTRY _EXPFUNC pow     (double __x, double __y);
  125. double      _RTLENTRY _EXPFUNC sin     (double __x);
  126. double      _RTLENTRY _EXPFUNC sinh    (double __x);
  127. double      _RTLENTRY _EXPFUNC sqrt    (double __x);
  128. double      _RTLENTRY _EXPFUNC tan     (double __x);
  129. double      _RTLENTRY _EXPFUNC tanh    (double __x);
  130.  
  131. long double _RTLENTRY _EXPFUNC acosl  (long double __x);
  132. long double _RTLENTRY _EXPFUNC asinl  (long double __x);
  133. long double _RTLENTRY _EXPFUNC atan2l (long double __x, long double __y);
  134. long double _RTLENTRY _EXPFUNC atanl  (long double __x);
  135. long double _RTLENTRY _EXPFUNC ceill  (long double __x);
  136. long double _RTLENTRY _EXPFUNC coshl  (long double __x);
  137. long double _RTLENTRY _EXPFUNC cosl   (long double __x);
  138. long double _RTLENTRY _EXPFUNC expl   (long double __x);
  139. long double _RTLENTRY _EXPFUNC fabsl  (long double __x);
  140. long double _RTLENTRY _EXPFUNC floorl (long double __x);
  141. long double _RTLENTRY _EXPFUNC fmodl  (long double __x, long double __y);
  142. long double _RTLENTRY _EXPFUNC frexpl (long double __x, int * __exponent);
  143. long double _RTLENTRY _EXPFUNC ldexpl (long double __x, int __exponent);
  144. long double _RTLENTRY _EXPFUNC log10l (long double __x);
  145. long double _RTLENTRY _EXPFUNC logl   (long double __x);
  146. long double _RTLENTRY _EXPFUNC modfl  (long double __x, long double * __ipart);
  147. long double _RTLENTRY _EXPFUNC powl   (long double __x, long double __y);
  148. long double _RTLENTRY _EXPFUNC sinhl  (long double __x);
  149. long double _RTLENTRY _EXPFUNC sinl   (long double __x);
  150. long double _RTLENTRY _EXPFUNC sqrtl  (long double __x);
  151. long double _RTLENTRY _EXPFUNC tanhl  (long double __x);
  152. long double _RTLENTRY _EXPFUNC tanl   (long double __x);
  153.  
  154. /* Intrinsic functions */
  155.  
  156. double      _RTLENTRY _EXPFUNC __sin__ (double __x);
  157. double      _RTLENTRY _EXPFUNC __cos__ (double __x);
  158. long double _RTLENTRY _EXPFUNC __cosl__(long double __x);
  159. long double _RTLENTRY _EXPFUNC __sinl__(long double __x);
  160.  
  161. #ifdef __cplusplus
  162. }
  163. #endif
  164.  
  165.  
  166. #if !defined(__STDC__) /* NON_ANSI */
  167.  
  168. #ifdef __cplusplus
  169. extern "C" {
  170. #endif
  171.  
  172. #if !defined(__ABS_DEFINED)
  173. #define __ABS_DEFINED
  174. int         _RTLENTRY __abs__(int);
  175. #ifdef __cplusplus
  176. inline int _RTLENTRY  abs(int __x) { return __abs__(__x); }
  177. #else
  178. int         _RTLENTRYF _EXPFUNC abs(int __x);
  179. #  define abs(x)   __abs__(x)
  180. #endif
  181. #endif /* __ABS_DEFINED */
  182.  
  183. double      _RTLENTRY _EXPFUNC atof    (const char * __s);
  184. long        _RTLENTRY _EXPFUNC labs    (long __x);
  185. double      _RTLENTRY _EXPFUNC pow10   (int __p);
  186.  
  187. long double _RTLENTRY _EXPFUNC _atold  (const char * __s);
  188.  
  189. int         _RTLENTRY          _matherr(struct exception  *__e);
  190. int         _RTLENTRY          _matherrl(struct _exceptionl *__e);
  191.  
  192. double      _RTLENTRY _EXPFUNC hypot   (double __x, double __y);
  193. double      _RTLENTRY _EXPFUNC poly    (double __x, int __degree, double coeffs []);
  194. long double _RTLENTRY _EXPFUNC hypotl  (long double __x, long double __y);
  195. long double _RTLENTRY _EXPFUNC polyl   (long double __x, int __degree, long double coeffs []);
  196. long double _RTLENTRY _EXPFUNC pow10l  (int __p);
  197.  
  198.  
  199. #ifdef __cplusplus
  200. }
  201. #endif
  202.  
  203. #endif  /* !__STDC__ */
  204.  
  205.  
  206.  
  207. #if !defined(RC_INVOKED)
  208.  
  209. #pragma option -a. /* restore default packing */
  210.  
  211. #if defined(__STDC__)
  212. #pragma warn .nak
  213. #endif
  214.  
  215. #endif  /* !RC_INVOKED */
  216.  
  217.  
  218. #endif  /* __MATH_H */
  219.  
  220.  
  221.  
  222.