home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April / Chip_1997-04_cd.bin / prezent / cb / data.z / MATH.H < prev    next >
C/C++ Source or Header  |  1997-01-16  |  12KB  |  349 lines

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