home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c063 / 1.ddi / INCLUDE.ZIP / MATH.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-18  |  4.9 KB  |  163 lines

  1. /*  math.h
  2.  
  3.     Definitions for the math floating point package.
  4.  
  5.     Copyright (c) 1987, 1991 by Borland International
  6.     All Rights Reserved.
  7. */
  8.  
  9. #ifndef  __MATH_H
  10. #define  __MATH_H
  11.  
  12. #if !defined( __DEFS_H )
  13. #include <_defs.h>
  14. #endif
  15.  
  16. #define HUGE_VAL    _huge_dble
  17. extern double _Cdecl _huge_dble;
  18. #define _LHUGE_VAL   _huge_ldble
  19. extern long double _Cdecl _huge_ldble;
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. double  _Cdecl acos  (double __x);
  25. double  _Cdecl asin  (double __x);
  26. double  _Cdecl atan  (double __x);
  27. double  _Cdecl atan2 (double __y, double __x);
  28. double  _Cdecl ceil  (double __x);
  29. double  _Cdecl cos   (double __x);
  30. double  _Cdecl cosh  (double __x);
  31. double  _Cdecl exp   (double __x);
  32. double  _Cdecl fabs  (double __x);
  33. double  _Cdecl __fabs__  (double __x);          /* Intrinsic */
  34. double  _Cdecl floor (double __x);
  35. double  _Cdecl fmod  (double __x, double __y);
  36. double  _Cdecl frexp (double __x, int *__exponent);
  37. double  _Cdecl ldexp (double __x, int __exponent);
  38. double  _Cdecl log   (double __x);
  39. double  _Cdecl log10 (double __x);
  40. double  _Cdecl modf  (double __x, double *__ipart);
  41. double  _Cdecl pow   (double __x, double __y);
  42. double  _Cdecl sin   (double __x);
  43. double  _Cdecl sinh  (double __x);
  44. double  _Cdecl sqrt  (double __x);
  45. double  _Cdecl tan   (double __x);
  46. double  _Cdecl tanh  (double __x);
  47.  
  48. long double _Cdecl acosl  (long double __x);
  49. long double _Cdecl asinl  (long double __x);
  50. long double _Cdecl atan2l (long double __x, long double __y);
  51. long double _Cdecl atanl  (long double __x);
  52. long double _Cdecl ceill  (long double __x);
  53. long double _Cdecl coshl  (long double __x);
  54. long double _Cdecl cosl   (long double __x);
  55. long double _Cdecl expl   (long double __x);
  56. long double _Cdecl fabsl  (long double __x);
  57. long double _Cdecl floorl (long double __x);
  58. long double _Cdecl fmodl  (long double __x, long double __y);
  59. long double _Cdecl frexpl (long double __x, int *__exponent);
  60. long double _Cdecl ldexpl (long double __x, int __exponent);
  61. long double _Cdecl log10l (long double __x);
  62. long double _Cdecl logl   (long double __x);
  63. long double _Cdecl modfl  (long double __x, long double *__ipart);
  64. long double _Cdecl powl   (long double __x, long double __y);
  65. long double _Cdecl sinhl  (long double __x);
  66. long double _Cdecl sinl   (long double __x);
  67. long double _Cdecl sqrtl  (long double __x);
  68. long double _Cdecl tanhl  (long double __x);
  69. long double _Cdecl tanl   (long double __x);
  70.  
  71. typedef enum
  72. {
  73.     DOMAIN = 1,    /* argument domain error -- log (-1)        */
  74.     SING,          /* argument singularity  -- pow (0,-2))     */
  75.     OVERFLOW,      /* overflow range error  -- exp (1000)      */
  76.     UNDERFLOW,     /* underflow range error -- exp (-1000)     */
  77.     TLOSS,         /* total loss of significance -- sin(10e70) */
  78.     PLOSS,         /* partial loss of signif. -- not used      */
  79.     STACKFAULT     /* floating point unit stack overflow       */
  80. }   _mexcep;
  81.  
  82. #ifdef __cplusplus
  83. }
  84. #endif
  85.  
  86.  
  87. #if !__STDC__
  88.  
  89. struct  exception 
  90. {
  91.     int type;
  92.     char   *name;
  93.     double  arg1, arg2, retval;
  94. };
  95.  
  96. struct  _exceptionl
  97. {
  98.     int type;
  99.     char   *name;
  100.     long double  arg1, arg2, retval;
  101. };
  102.  
  103. #ifdef __cplusplus
  104. extern "C" {
  105. #endif
  106. int     _Cdecl abs   (int __x);
  107. double  _Cdecl atof  (const char *__s);
  108. double  _Cdecl hypot (double __x, double __y);
  109. long    _Cdecl labs  (long __x);
  110. int     _Cdecl matherr (struct exception *__e);
  111. double  _Cdecl poly  (double __x, int __degree, double *__coeffs);
  112. double  _Cdecl pow10 (int __p);
  113. int     _Cdecl _matherrl (struct _exceptionl *__e);
  114.  
  115. long double _Cdecl _atold (const char *__s);
  116. long double _Cdecl hypotl (long double __x, long double __y);
  117. long double _Cdecl polyl  (long double __x, int __degree, long double *__coeffs);
  118. long double _Cdecl pow10l (int __p);
  119.  
  120. #ifdef __cplusplus
  121.     /* use class complex instead of cabs in C++ */
  122. #else
  123. struct complex      /* as used by "cabs" function */
  124. {
  125.     double  x, y;
  126. };
  127.  
  128. struct _complexl    /* as used by "cabsl" function */
  129. {
  130.     long double  x, y;
  131. };
  132.  
  133. #define cabs(z)     (hypot  ((z).x, (z).y))
  134. #define cabsl(z)    (hypotl ((z).x, (z).y))
  135. #endif
  136.  
  137. #ifdef __cplusplus
  138. }
  139. #endif
  140.  
  141. /* Constants rounded for 21 decimals. */
  142. #define M_E         2.71828182845904523536
  143. #define M_LOG2E     1.44269504088896340736
  144. #define M_LOG10E    0.434294481903251827651
  145. #define M_LN2       0.693147180559945309417
  146. #define M_LN10      2.30258509299404568402
  147. #define M_PI        3.14159265358979323846
  148. #define M_PI_2      1.57079632679489661923
  149. #define M_PI_4      0.785398163397448309616
  150. #define M_1_PI      0.318309886183790671538
  151. #define M_2_PI      0.636619772367581343076
  152. #define M_1_SQRTPI  0.564189583547756286948
  153. #define M_2_SQRTPI  1.12837916709551257390
  154. #define M_SQRT2     1.41421356237309504880
  155. #define M_SQRT_2    0.707106781186547524401
  156.  
  157. #define EDOM    33      /* Math argument */
  158. #define ERANGE  34      /* Result too large */
  159.  
  160. #endif  /* !__STDC__ */
  161.  
  162. #endif
  163.