home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / gmt_os2.zip / src / math / fdlibm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-16  |  6.0 KB  |  216 lines

  1.  
  2. /* @(#)fdlibm.h 1.5 95/01/18 */
  3. /*
  4.  * ====================================================
  5.  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  6.  *
  7.  * Developed at SunSoft, a Sun Microsystems, Inc. business.
  8.  * Permission to use, copy, modify, and distribute this
  9.  * software is freely granted, provided that this notice 
  10.  * is preserved.
  11.  * ====================================================
  12.  */
  13.  
  14. #ifdef __NEWVALID    /* special setup for Sun test regime */
  15. #if defined(i386) || defined(i486) || \
  16.     defined(intel) || defined(x86) || defined(i86pc)
  17. #define __LITTLE_ENDIAN
  18. #endif
  19. #endif
  20.  
  21. #ifdef __LITTLE_ENDIAN
  22. #define __HI(x) *(1+(int*)&x)
  23. #define __LO(x) *(int*)&x
  24. #define __HIp(x) *(1+(int*)x)
  25. #define __LOp(x) *(int*)x
  26. #else
  27. #define __HI(x) *(int*)&x
  28. #define __LO(x) *(1+(int*)&x)
  29. #define __HIp(x) *(int*)x
  30. #define __LOp(x) *(1+(int*)x)
  31. #endif
  32.  
  33. #ifdef __STDC__
  34. #define    __P(p)    p
  35. #else
  36. #define    __P(p)    ()
  37. #endif
  38.  
  39. /*
  40.  * ANSI/POSIX
  41.  */
  42.  
  43. extern int signgam;
  44.  
  45. #define    MAXFLOAT    ((float)3.40282346638528860e+38)
  46.  
  47. enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
  48.  
  49. #define _LIB_VERSION_TYPE enum fdversion
  50. #define _LIB_VERSION _fdlib_version  
  51.  
  52. /* if global variable _LIB_VERSION is not desirable, one may 
  53.  * change the following to be a constant by: 
  54.  *    #define _LIB_VERSION_TYPE const enum version
  55.  * In that case, after one initializes the value _LIB_VERSION (see
  56.  * s_lib_version.c) during compile time, it cannot be modified
  57.  * in the middle of a program
  58.  */ 
  59. extern  _LIB_VERSION_TYPE  _LIB_VERSION;
  60.  
  61. #define _IEEE_  fdlibm_ieee
  62. #define _SVID_  fdlibm_svid
  63. #define _XOPEN_ fdlibm_xopen
  64. #define _POSIX_ fdlibm_posix
  65.  
  66. struct exception {
  67.     int type;
  68.     char *name;
  69.     double arg1;
  70.     double arg2;
  71.     double retval;
  72. };
  73.  
  74. #define    HUGE        MAXFLOAT
  75.  
  76. /* 
  77.  * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
  78.  * (one may replace the following line by "#include <values.h>")
  79.  */
  80.  
  81. #define X_TLOSS        1.41484755040568800000e+16 
  82.  
  83. #define    DOMAIN        1
  84. #define    SING        2
  85. #define    OVERFLOW    3
  86. #define    UNDERFLOW    4
  87. #define    TLOSS        5
  88. #define    PLOSS        6
  89.  
  90. /*
  91.  * ANSI/POSIX
  92.  */
  93. extern double acos __P((double));
  94. extern double asin __P((double));
  95. extern double atan __P((double));
  96. extern double atan2 __P((double, double));
  97. extern double cos __P((double));
  98. extern double sin __P((double));
  99. extern double tan __P((double));
  100.  
  101. extern double cosh __P((double));
  102. extern double sinh __P((double));
  103. extern double tanh __P((double));
  104.  
  105. extern double exp __P((double));
  106. extern double frexp __P((double, int *));
  107. extern double ldexp __P((double, int));
  108. extern double log __P((double));
  109. extern double log10 __P((double));
  110. extern double modf __P((double, double *));
  111.  
  112. extern double pow __P((double, double));
  113. extern double sqrt __P((double));
  114.  
  115. extern double ceil __P((double));
  116. extern double fabs __P((double));
  117. extern double floor __P((double));
  118. extern double fmod __P((double, double));
  119.  
  120. extern double erf __P((double));
  121. extern double erfc __P((double));
  122. extern double gamma __P((double));
  123. extern double hypot __P((double, double));
  124. extern int isnan __P((double));
  125. extern int finite __P((double));
  126. extern double j0 __P((double));
  127. extern double j1 __P((double));
  128. extern double jn __P((int, double));
  129. extern double lgamma __P((double));
  130. extern double y0 __P((double));
  131. extern double y1 __P((double));
  132. extern double yn __P((int, double));
  133.  
  134. extern double acosh __P((double));
  135. extern double asinh __P((double));
  136. extern double atanh __P((double));
  137. extern double cbrt __P((double));
  138. extern double logb __P((double));
  139. extern double nextafter __P((double, double));
  140. extern double remainder __P((double, double));
  141. #ifdef _SCALB_INT
  142. extern double scalb __P((double, int));
  143. #else
  144. extern double scalb __P((double, double));
  145. #endif
  146.  
  147. extern int matherr __P((struct exception *));
  148.  
  149. /*
  150.  * IEEE Test Vector
  151.  */
  152. extern double significand __P((double));
  153.  
  154. /*
  155.  * Functions callable from C, intended to support IEEE arithmetic.
  156.  */
  157. extern double copysign __P((double, double));
  158. extern int ilogb __P((double));
  159. extern double rint __P((double));
  160. extern double scalbn __P((double, int));
  161.  
  162. /*
  163.  * BSD math library entry points
  164.  */
  165. extern double expm1 __P((double));
  166. extern double log1p __P((double));
  167.  
  168. /*
  169.  * Reentrant version of gamma & lgamma; passes signgam back by reference
  170.  * as the second argument; user must allocate space for signgam.
  171.  */
  172. #ifdef _REENTRANT
  173. extern double gamma_r __P((double, int *));
  174. extern double lgamma_r __P((double, int *));
  175. #endif    /* _REENTRANT */
  176.  
  177. /* ieee style elementary functions */
  178. extern double __ieee754_sqrt __P((double));            
  179. extern double __ieee754_acos __P((double));            
  180. extern double __ieee754_acosh __P((double));            
  181. extern double __ieee754_log __P((double));            
  182. extern double __ieee754_atanh __P((double));            
  183. extern double __ieee754_asin __P((double));            
  184. extern double __ieee754_atan2 __P((double,double));            
  185. extern double __ieee754_exp __P((double));
  186. extern double __ieee754_cosh __P((double));
  187. extern double __ieee754_fmod __P((double,double));
  188. extern double __ieee754_pow __P((double,double));
  189. extern double __ieee754_lgamma_r __P((double,int *));
  190. extern double __ieee754_gamma_r __P((double,int *));
  191. extern double __ieee754_lgamma __P((double));
  192. extern double __ieee754_gamma __P((double));
  193. extern double __ieee754_log10 __P((double));
  194. extern double __ieee754_sinh __P((double));
  195. extern double __ieee754_hypot __P((double,double));
  196. extern double __ieee754_j0 __P((double));
  197. extern double __ieee754_j1 __P((double));
  198. extern double __ieee754_y0 __P((double));
  199. extern double __ieee754_y1 __P((double));
  200. extern double __ieee754_jn __P((int,double));
  201. extern double __ieee754_yn __P((int,double));
  202. extern double __ieee754_remainder __P((double,double));
  203. extern int    __ieee754_rem_pio2 __P((double,double*));
  204. #ifdef _SCALB_INT
  205. extern double __ieee754_scalb __P((double,int));
  206. #else
  207. extern double __ieee754_scalb __P((double,double));
  208. #endif
  209.  
  210. /* fdlibm kernel function */
  211. extern double __kernel_standard __P((double,double,int));    
  212. extern double __kernel_sin __P((double,double,int));
  213. extern double __kernel_cos __P((double,double));
  214. extern double __kernel_tan __P((double,double,int));
  215. extern int    __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));
  216.