Back to index

lightning-sunbird  0.9+nobinonly
fdlibm.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is Mozilla Communicator client code, released
00017  * March 31, 1998.
00018  *
00019  * The Initial Developer of the Original Code is
00020  * Sun Microsystems, Inc.
00021  * Portions created by the Initial Developer are Copyright (C) 1998
00022  * the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 /* @(#)fdlibm.h 1.5 95/01/18 */
00041 /*
00042  * ====================================================
00043  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00044  *
00045  * Developed at SunSoft, a Sun Microsystems, Inc. business.
00046  * Permission to use, copy, modify, and distribute this
00047  * software is freely granted, provided that this notice 
00048  * is preserved.
00049  * ====================================================
00050  */
00051 
00052 /* Modified defines start here.. */
00053 #undef __LITTLE_ENDIAN
00054 
00055 #ifdef _WIN32
00056 #define huge myhuge
00057 #define __LITTLE_ENDIAN
00058 #endif
00059 
00060 #ifdef XP_OS2
00061 #define __LITTLE_ENDIAN
00062 #endif
00063 
00064 #if defined(linux) && (defined(__i386__) || defined(__x86_64__) || defined(__ia64) || (defined(__mips) && defined(__MIPSEL__)))
00065 #define __LITTLE_ENDIAN
00066 #endif
00067 
00068 /* End here. The rest is the standard file. */
00069 
00070 #ifdef SOLARIS       /* special setup for Sun test regime */
00071 #if defined(i386) || defined(i486) || \
00072        defined(intel) || defined(x86) || defined(i86pc)
00073 #define __LITTLE_ENDIAN
00074 #endif
00075 #endif
00076 
00077 typedef union {
00078 #ifdef __LITTLE_ENDIAN
00079     struct { int lo, hi; } ints;
00080 #else
00081     struct { int hi, lo; } ints;
00082 #endif
00083     double d;
00084 } fd_twoints;
00085 
00086 #define __HI(x) x.ints.hi
00087 #define __LO(x) x.ints.lo
00088 
00089 #undef __P
00090 #ifdef __STDC__
00091 #define       __P(p) p
00092 #else
00093 #define       __P(p) ()
00094 #endif
00095 
00096 /*
00097  * ANSI/POSIX
00098  */
00099 
00100 extern int signgam;
00101 
00102 #define       MAXFLOAT      ((float)3.40282346638528860e+38)
00103 
00104 enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
00105 
00106 #define _LIB_VERSION_TYPE enum fdversion
00107 #define _LIB_VERSION _fdlib_version  
00108 
00109 /* if global variable _LIB_VERSION is not desirable, one may 
00110  * change the following to be a constant by: 
00111  *     #define _LIB_VERSION_TYPE const enum version
00112  * In that case, after one initializes the value _LIB_VERSION (see
00113  * s_lib_version.c) during compile time, it cannot be modified
00114  * in the middle of a program
00115  */ 
00116 extern  _LIB_VERSION_TYPE  _LIB_VERSION;
00117 
00118 #define _IEEE_  fdlibm_ieee
00119 #define _SVID_  fdlibm_svid
00120 #define _XOPEN_ fdlibm_xopen
00121 #define _POSIX_ fdlibm_posix
00122 
00123 struct exception {
00124        int type;
00125        char *name;
00126        double arg1;
00127        double arg2;
00128        double retval;
00129 };
00130 
00131 #define       HUGE          MAXFLOAT
00132 
00133 /* 
00134  * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
00135  * (one may replace the following line by "#include <values.h>")
00136  */
00137 
00138 #define X_TLOSS             1.41484755040568800000e+16 
00139 
00140 #define       DOMAIN        1
00141 #define       SING          2
00142 #define       OVERFLOW      3
00143 #define       UNDERFLOW     4
00144 #define       TLOSS         5
00145 #define       PLOSS         6
00146 
00147 /*
00148  * ANSI/POSIX
00149  */
00150 
00151 extern double fd_acos __P((double));
00152 extern double fd_asin __P((double));
00153 extern double fd_atan __P((double));
00154 extern double fd_atan2 __P((double, double));
00155 extern double fd_cos __P((double));
00156 extern double fd_sin __P((double));
00157 extern double fd_tan __P((double));
00158  
00159 extern double fd_cosh __P((double));
00160 extern double fd_sinh __P((double));
00161 extern double fd_tanh __P((double));
00162 
00163 extern double fd_exp __P((double));
00164 extern double fd_frexp __P((double, int *));
00165 extern double fd_ldexp __P((double, int));
00166 extern double fd_log __P((double));
00167 extern double fd_log10 __P((double));
00168 extern double fd_modf __P((double, double *));
00169 
00170 extern double fd_pow __P((double, double));
00171 extern double fd_sqrt __P((double));
00172 
00173 extern double fd_ceil __P((double));
00174 extern double fd_fabs __P((double));
00175 extern double fd_floor __P((double));
00176 extern double fd_fmod __P((double, double));
00177 
00178 extern double fd_erf __P((double));
00179 extern double fd_erfc __P((double));
00180 extern double fd_gamma __P((double));
00181 extern double fd_hypot __P((double, double));
00182 extern int fd_isnan __P((double));
00183 extern int fd_finite __P((double));
00184 extern double fd_j0 __P((double));
00185 extern double fd_j1 __P((double));
00186 extern double fd_jn __P((int, double));
00187 extern double fd_lgamma __P((double));
00188 extern double fd_y0 __P((double));
00189 extern double fd_y1 __P((double));
00190 extern double fd_yn __P((int, double));
00191 
00192 extern double fd_acosh __P((double));
00193 extern double fd_asinh __P((double));
00194 extern double fd_atanh __P((double));
00195 extern double fd_cbrt __P((double));
00196 extern double fd_logb __P((double));
00197 extern double fd_nextafter __P((double, double));
00198 extern double fd_remainder __P((double, double));
00199 #ifdef _SCALB_INT
00200 extern double fd_scalb __P((double, int));
00201 #else
00202 extern double fd_scalb __P((double, double));
00203 #endif
00204 
00205 extern int fd_matherr __P((struct exception *));
00206 
00207 /*
00208  * IEEE Test Vector
00209  */
00210 extern double significand __P((double));
00211 
00212 /*
00213  * Functions callable from C, intended to support IEEE arithmetic.
00214  */
00215 extern double fd_copysign __P((double, double));
00216 extern int fd_ilogb __P((double));
00217 extern double fd_rint __P((double));
00218 extern double fd_scalbn __P((double, int));
00219 
00220 /*
00221  * BSD math library entry points
00222  */
00223 extern double fd_expm1 __P((double));
00224 extern double fd_log1p __P((double));
00225 
00226 /*
00227  * Reentrant version of gamma & lgamma; passes signgam back by reference
00228  * as the second argument; user must allocate space for signgam.
00229  */
00230 #ifdef _REENTRANT
00231 extern double gamma_r __P((double, int *));
00232 extern double lgamma_r __P((double, int *));
00233 #endif /* _REENTRANT */
00234 
00235 /* ieee style elementary functions */
00236 extern double __ieee754_sqrt __P((double));                    
00237 extern double __ieee754_acos __P((double));                    
00238 extern double __ieee754_acosh __P((double));                   
00239 extern double __ieee754_log __P((double));                     
00240 extern double __ieee754_atanh __P((double));                   
00241 extern double __ieee754_asin __P((double));                    
00242 extern double __ieee754_atan2 __P((double,double));                   
00243 extern double __ieee754_exp __P((double));
00244 extern double __ieee754_cosh __P((double));
00245 extern double __ieee754_fmod __P((double,double));
00246 extern double __ieee754_pow __P((double,double));
00247 extern double __ieee754_lgamma_r __P((double,int *));
00248 extern double __ieee754_gamma_r __P((double,int *));
00249 extern double __ieee754_lgamma __P((double));
00250 extern double __ieee754_gamma __P((double));
00251 extern double __ieee754_log10 __P((double));
00252 extern double __ieee754_sinh __P((double));
00253 extern double __ieee754_hypot __P((double,double));
00254 extern double __ieee754_j0 __P((double));
00255 extern double __ieee754_j1 __P((double));
00256 extern double __ieee754_y0 __P((double));
00257 extern double __ieee754_y1 __P((double));
00258 extern double __ieee754_jn __P((int,double));
00259 extern double __ieee754_yn __P((int,double));
00260 extern double __ieee754_remainder __P((double,double));
00261 extern int    __ieee754_rem_pio2 __P((double,double*));
00262 #ifdef _SCALB_INT
00263 extern double __ieee754_scalb __P((double,int));
00264 #else
00265 extern double __ieee754_scalb __P((double,double));
00266 #endif
00267 
00268 /* fdlibm kernel function */
00269 extern double __kernel_standard __P((double,double,int,int*));
00270 extern double __kernel_sin __P((double,double,int));
00271 extern double __kernel_cos __P((double,double));
00272 extern double __kernel_tan __P((double,double,int));
00273 extern int    __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));