home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / win3 / patches / symantec / rtlinc.exe / MATH.H < prev    next >
C/C++ Source or Header  |  1993-08-02  |  6KB  |  230 lines

  1. /*_ math.h   Fri Jan 20 1989   Modified by: Walter Bright */
  2. /* Copyright (C) 1985-1989 by Walter Bright    */
  3. /* All Rights Reserved                    */
  4. /* $Revision:   1.3  $ */
  5.  
  6. #ifndef __MATH_H
  7. #define __MATH_H    1
  8.  
  9. #if __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. #if __ZTC__ < 0x220
  14. #define HUGE_VAL    1.797693134862315e+308
  15. #else
  16. #define HUGE_VAL    __inf
  17. #endif
  18.  
  19. #ifdef __STDC__
  20. #define __CDECL
  21. #define __STDCALL
  22. #else
  23. #define __CDECL __cdecl
  24. #define __STDCALL __stdcall
  25. #endif
  26.  
  27. #if __OS2__ && __INTSIZE == 4
  28. #define __CLIB    __STDCALL
  29. #else
  30. #define __CLIB    __CDECL
  31. #endif
  32.  
  33. double    __CLIB acos(double);
  34. double    __CLIB asin(double);
  35. double    __CLIB atan(double);
  36. double    __CLIB atan2(double,double);
  37. double    __CLIB cos(double);
  38. double    __CLIB sin(double);
  39. double    __CLIB tan(double);
  40. double    __CLIB cosh(double);
  41. double    __CLIB sinh(double);
  42. double    __CLIB tanh(double);
  43. double    __CLIB exp(double);
  44. double    __CLIB frexp(double,int *);
  45. double    __CLIB ldexp(double,int);
  46. double    __CLIB log(double);
  47. double    __CLIB log10(double);
  48. double    __CLIB modf(double,double *);
  49. double    __CLIB pow(double,double);
  50. double    __CLIB sqrt(double);
  51. double    __CLIB ceil(double);
  52. double    __CLIB fabs(double);
  53. double    __CLIB floor(double);
  54. double    __CLIB fmod(double,double);
  55.  
  56. /* Built-in versions    */
  57. #if __ZTC__ >= 0x302
  58. double    __CLIB _inline_fabs(double);
  59. #define fabs(d) _inline_fabs(d)
  60.  
  61. #if __INLINE_8087
  62. double    __CLIB _inline_sqrt(double);
  63. #define sqrt(d) _inline_sqrt(d)
  64. #endif
  65. #endif
  66.  
  67. #ifndef __STDC__    /* non-ANSI stuff    */
  68.  
  69. double    __CLIB log1p(double);
  70. double    __CLIB expm1(double);
  71.  
  72. float    __CLIB acosf(float);
  73. float    __CLIB asinf(float);
  74. float    __CLIB atanf(float);
  75. float    __CLIB atan2f(float,float);
  76. float    __CLIB cosf(float);
  77. float    __CLIB sinf(float);
  78. float    __CLIB tanf(float);
  79. float    __CLIB coshf(float);
  80. float    __CLIB sinhf(float);
  81. float    __CLIB tanhf(float);
  82. float    __CLIB expf(float);
  83. float    __CLIB frexpf(float,int *);
  84. float    __CLIB ldexpf(float,int);
  85. float    __CLIB logf(float);
  86. float    __CLIB log10f(float);
  87. float    __CLIB modff(float,float *);
  88. float    __CLIB powf(float,float);
  89. float    __CLIB sqrtf(float);
  90. float    __CLIB ceilf(float);
  91. float    __CLIB fabsf(float);
  92. float    __CLIB floorf(float);
  93. float    __CLIB fmodf(float,float);
  94. float    __CLIB log1pf(float);
  95. float    __CLIB expm1f(float);
  96. long double __CLIB expl(long double x);
  97.  
  98. /* Built-in versions    */
  99. #if __ZTC__ >= 0x302
  100. float    __CLIB _inline_fabsf(float);
  101. #define fabsf(f) _inline_fabsf(f)
  102.  
  103. #if __INLINE_8087
  104. float    __CLIB _inline_sqrtf(float);
  105. #define sqrtf(f) _inline_sqrtf(f)
  106. #endif
  107. #endif
  108.  
  109. #define acosl    acos
  110. #define asinl    asin
  111. #define _asinl    asinl
  112. #define atanl    atan
  113. #define _atanl    atanl
  114. #define atan2l    atan2
  115. #define _atan2l    atan2l
  116. #define cosl    cos
  117. #define _cosl    cos
  118. #define sinl    sin
  119. #define _sinl    sin
  120. #define tanl    tan
  121. #define _tanl    tan
  122. #define coshl    cosh
  123. #define _coshl    cosh
  124. #define sinhl    sinh
  125. #define _sinhl    sinh
  126. #define tanhl    tanh
  127. #define _tanhl    tanh
  128. #define expl    exp
  129. #define frexpl    frexp
  130. #define _frexpl    frexp
  131. #define ldexpl    ldexp
  132. #define _ldexpl    ldexp
  133. #define logl    log
  134. #define _logl    log
  135. #define log10l    log10
  136. #define _log10l    log10
  137. #define modfl    modf
  138. #define _modfl    modf
  139. #define powl    pow
  140. #define _powl    pow
  141. #define sqrtl    sqrt
  142. #define _sqrtl    sqrt
  143. #define ceill    ceil
  144. #define _ceill ceil
  145. #define fabsl    fabs
  146. #define _fabsl    fabs
  147. #define floorl    floor
  148. #define _floorl    floor
  149. #define fmodl    fmod
  150. #define _fmodl    fmod
  151. #define log1pl    log1p
  152. #define expm1l    expm1
  153. #define _expl    expl
  154.  
  155. /* Constants that the 8087 supports directly    */
  156. #define PI        3.14159265358979323846
  157. #define LOG2        0.30102999566398119521
  158. #define LN2        0.6931471805599453094172321
  159. #define LOG2T        3.32192809488736234787
  160. #define LOG2E        1.4426950408889634074    /* 1/LN2        */
  161.  
  162. /* For unix compatibility    */
  163. #define    M_LOG2E        LOG2E
  164. #define    M_LN2        LN2
  165. #define    M_PI        PI
  166. #define    M_E        2.7182818284590452354
  167. #define    M_LOG10E    0.43429448190325182765
  168. #define    M_LN10        2.30258509299404568402
  169. #define    M_PI_2        1.57079632679489661923
  170. #define    M_PI_4        0.78539816339744830962
  171. #define    M_1_PI        0.31830988618379067154
  172. #define    M_2_PI        0.63661977236758134308
  173. #define    M_2_SQRTPI    1.12837916709551257390
  174. #define    M_SQRT2        1.41421356237309504880
  175. #define    M_SQRT1_2    0.70710678118654752440
  176.  
  177. /* Struct used with matherr() when a floating point exception occurs    */
  178. struct exception
  179. {    int type;    /* DOMAIN,SING,...                */
  180.     char *name;    /* pointer to string defining the name of the    */
  181.             /* function that detected the error        */
  182.     double arg1;    /* first argument to function            */
  183.     double arg2;    /* second argument (if defined) to function    */
  184.     double retval;    /* default return value                */
  185. };
  186. #define _exception exception
  187.  
  188. /* Values for exception.type    */
  189. #define DOMAIN        1    /* arguments are out of range for the function */
  190. #define SING        2    /* argument is a singularity        */
  191. #define    OVERFLOW    3
  192. #define UNDERFLOW    4
  193. #define TLOSS        5    /* total loss of significant digits    */
  194. #define PLOSS        6    /* partial loss of significant digits    */
  195. #define DIVIDE_BY_ZERO  7
  196.  
  197. int    __CLIB matherr(struct exception *);
  198. double    __CLIB atof(const char *);
  199. #define _atold atof
  200. #define _matherr matherr
  201. double    __CLIB hypot(double,double);
  202. #define    _hypot    hypot
  203. #define    _hypotl    hypot
  204. #define    hypotl    hypot
  205. double    __CLIB poly(double,int,double []);
  206.  
  207. #if !__cplusplus
  208.  
  209. struct complex
  210. {
  211.    double x,y;
  212. };
  213.  
  214. #define cabs(z) (hypot(z.x,z.y))
  215.  
  216. #define complexl complex
  217. #define _cabs cabs
  218. #define cabsl cabs
  219. #define _cabsl cabs
  220.  
  221. #endif
  222.  
  223. #endif
  224.  
  225. #if __cplusplus
  226. }
  227. #endif
  228.  
  229. #endif /* __MATH_H */
  230.