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