home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / uccs / root.14 / udk / usr / include / math.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-19  |  5.7 KB  |  218 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. #ifndef _MATH_H
  12. #define _MATH_H
  13. #ident    "@(#)sgs-head:i386/head/math.h    2.11.7.9"
  14.  
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18.  
  19. #if (__STDC__ - 0 == 0) && !defined(_XOPEN_SOURCE) \
  20.     && !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
  21.  
  22. enum version {c_issue_4, ansi_1, strict_ansi};
  23.  
  24. extern const enum version _lib_version;
  25.  
  26. #ifndef __cplusplus
  27.  
  28. struct exception
  29. {
  30.     int    type;
  31.     char    *name;
  32.     double    arg1;
  33.     double    arg2;
  34.     double    retval;
  35. };
  36.  
  37. extern int    matherr(struct exception *);
  38.  
  39. #endif /*__cplusplus*/
  40.  
  41. #endif /*(__STDC__ - 0 == 0) && ...*/
  42.  
  43. extern double    acos(double);
  44. extern double    asin(double);
  45. extern double    atan(double);
  46. extern double    atan2(double, double);
  47. extern double    cos(double);
  48. extern double    sin(double);
  49. extern double    tan(double);
  50.  
  51. extern double    cosh(double);
  52. extern double    sinh(double);
  53. extern double    tanh(double);
  54.  
  55. extern double    exp(double);
  56. extern double    frexp(double, int *);
  57. extern double    ldexp(double, int);
  58. extern double    log(double);
  59. extern double    log10(double);
  60. extern double    modf(double, double *);
  61.  
  62. long double    frexpl(long double, int *);
  63. long double    ldexpl(long double, int);
  64. long double    modfl(long double, long double *);
  65.  
  66. extern double    pow(double, double);
  67. extern double    sqrt(double);
  68.  
  69. extern double    ceil(double);
  70. extern double    fabs(double);
  71. extern double    floor(double);
  72. extern double    fmod(double, double);
  73.  
  74. extern float    acosf(float);
  75. extern float    asinf(float);
  76. extern float    atanf(float);
  77. extern float    atan2f(float, float);
  78. extern float    cosf(float);
  79. extern float    sinf(float);
  80. extern float    tanf(float);
  81.  
  82. extern float    coshf(float);
  83. extern float    sinhf(float);
  84. extern float    tanhf(float);
  85.  
  86. extern float    expf(float);
  87. extern float    logf(float);
  88. extern float    log10f(float);
  89.  
  90. extern float    powf(float, float);
  91. extern float    sqrtf(float);
  92.  
  93. extern float    ceilf(float);
  94. extern float    fabsf(float);
  95. extern float    floorf(float);
  96. extern float    fmodf(float, float);
  97. extern float    modff(float, float *);
  98.  
  99. #ifndef HUGE_VAL
  100. extern const double __huge_val;
  101. #define HUGE_VAL (+__huge_val)
  102. #endif
  103.  
  104. #if defined(_XOPEN_SOURCE) || (__STDC__ - 0 == 0 \
  105.     && !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE))
  106.  
  107. extern double    erf(double);
  108. extern double    erfc(double);
  109. extern double    gamma(double);
  110. extern double    hypot(double, double);
  111. extern double    j0(double);
  112. extern double    j1(double);
  113. extern double    jn(int, double);
  114. extern double    y0(double);
  115. extern double    y1(double);
  116. extern double    yn(int, double);
  117. extern double    lgamma(double);
  118. extern int    isnan(double);
  119.  
  120. #ifndef MAXFLOAT
  121. #define MAXFLOAT    3.40282346638528860e+38F
  122. #endif
  123.  
  124. #endif /*defined(_XOPEN_SOURCE) || ...*/
  125.  
  126. #if (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1) \
  127.     || (__STDC__ - 0 == 0 && !defined(_XOPEN_SOURCE) \
  128.     && !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE))
  129.  
  130. extern double    acosh(double);
  131. extern double    asinh(double);
  132. extern double    atanh(double);
  133. extern double    cbrt(double);
  134. extern double    expm1(double);
  135. extern int    ilogb(double);
  136. extern double    logb(double);
  137. extern double    log1p(double);
  138. extern double    nextafter(double, double);
  139. extern double    remainder(double, double);
  140. extern double    rint(double);
  141. extern double    scalb(double, double);
  142.  
  143. #endif /*(defined(_XOPEN_SOURCE) && ...*/
  144.  
  145. #if __STDC__ - 0 == 0 && !defined(_XOPEN_SOURCE) \
  146.     && !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
  147.  
  148. #define HUGE    MAXFLOAT
  149.  
  150. extern double    atof(const char *);
  151.  
  152. extern double    copysign(double, double);
  153. extern int    unordered(double, double);
  154. extern int    finite(double);
  155.  
  156. long double    scalbl(long double, long double);
  157. long double    logbl(long double);
  158. long double    nextafterl(long double, long double);
  159. extern int    unorderedl(long double, long double);
  160. extern int    finitel(long double);
  161.  
  162. #endif /*__STDC__ - 0 == 0 && ...*/
  163.  
  164. #if defined(_XOPEN_SOURCE) || (__STDC__ - 0 == 0 \
  165.     && !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE))
  166.  
  167. extern int    signgam;
  168.  
  169. #define M_E        2.7182818284590452354
  170. #define M_LOG2E        1.4426950408889634074
  171. #define M_LOG10E    0.43429448190325182765
  172. #define M_LN2        0.69314718055994530942
  173. #define M_LN10        2.30258509299404568402
  174. #define M_PI        3.14159265358979323846
  175. #define M_PI_2        1.57079632679489661923
  176. #define M_PI_4        0.78539816339744830962
  177. #define M_1_PI        0.31830988618379067154
  178. #define M_2_PI        0.63661977236758134308
  179. #define M_2_SQRTPI    1.12837916709551257390
  180. #define M_SQRT2        1.41421356237309504880
  181. #define M_SQRT1_2    0.70710678118654752440
  182.  
  183. #endif /*defined(_XOPEN_SOURCE) || ...*/
  184.  
  185. #if (__STDC__ - 0 == 0) && !defined(_XOPEN_SOURCE) \
  186.     && !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
  187.  
  188. #define _ABS(x)        ((x) < 0 ? -(x) : (x))
  189.  
  190. #define _REDUCE(TYPE, X, XN, C1, C2)    { \
  191.     double x1 = (double)(TYPE)X, x2 = X - x1; \
  192.     X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); }
  193.  
  194. #define DOMAIN        1
  195. #define    SING        2
  196. #define    OVERFLOW    3
  197. #define    UNDERFLOW    4
  198. #define    TLOSS        5
  199. #define    PLOSS        6
  200.  
  201. #define _POLY1(x, c)    ((c)[0] * (x) + (c)[1])
  202. #define _POLY2(x, c)    (_POLY1((x), (c)) * (x) + (c)[2])
  203. #define _POLY3(x, c)    (_POLY2((x), (c)) * (x) + (c)[3])
  204. #define _POLY4(x, c)    (_POLY3((x), (c)) * (x) + (c)[4])
  205. #define _POLY5(x, c)    (_POLY4((x), (c)) * (x) + (c)[5])
  206. #define _POLY6(x, c)    (_POLY5((x), (c)) * (x) + (c)[6])
  207. #define _POLY7(x, c)    (_POLY6((x), (c)) * (x) + (c)[7])
  208. #define _POLY8(x, c)    (_POLY7((x), (c)) * (x) + (c)[8])
  209. #define _POLY9(x, c)    (_POLY8((x), (c)) * (x) + (c)[9])
  210.  
  211. #endif /*(__STDC__ - 0 == 0) && ...*/
  212.  
  213. #ifdef __cplusplus
  214. }
  215. #endif
  216.  
  217. #endif /*_MATH_H*/
  218.