/[jscoverage]/trunk/js/src/fdlibm/fdlibm.h
ViewVC logotype

Contents of /trunk/js/src/fdlibm/fdlibm.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Wed Aug 1 13:51:53 2007 UTC (12 years, 1 month ago) by siliconforks
File MIME type: text/plain
File size: 12443 byte(s)
Initial import.

1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is Mozilla Communicator client code, released
17 * March 31, 1998.
18 *
19 * The Initial Developer of the Original Code is
20 * Sun Microsystems, Inc.
21 * Portions created by the Initial Developer are Copyright (C) 1998
22 * the Initial Developer. All Rights Reserved.
23 *
24 * Contributor(s):
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 /* @(#)fdlibm.h 1.5 95/01/18 */
41 /*
42 * ====================================================
43 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
44 *
45 * Developed at SunSoft, a Sun Microsystems, Inc. business.
46 * Permission to use, copy, modify, and distribute this
47 * software is freely granted, provided that this notice
48 * is preserved.
49 * ====================================================
50 */
51
52 #ifdef OSSP
53 /* select functionality */
54 #define _IEEE_LIBM
55 /* avoid namespace pollution */
56 #define __ieee754_acos js___ieee754_acos
57 #define __ieee754_acosh js___ieee754_acosh
58 #define __ieee754_asin js___ieee754_asin
59 #define __ieee754_atan2 js___ieee754_atan2
60 #define __ieee754_atanh js___ieee754_atanh
61 #define __ieee754_cosh js___ieee754_cosh
62 #define __ieee754_exp js___ieee754_exp
63 #define __ieee754_fmod js___ieee754_fmod
64 #define __ieee754_gamma js___ieee754_gamma
65 #define __ieee754_gamma_r js___ieee754_gamma_r
66 #define __ieee754_hypot js___ieee754_hypot
67 #define __ieee754_j0 js___ieee754_j0
68 #define __ieee754_j1 js___ieee754_j1
69 #define __ieee754_jn js___ieee754_jn
70 #define __ieee754_lgamma js___ieee754_lgamma
71 #define __ieee754_lgamma_r js___ieee754_lgamma_r
72 #define __ieee754_log js___ieee754_log
73 #define __ieee754_log10 js___ieee754_log10
74 #define __ieee754_pow js___ieee754_pow
75 #define __ieee754_rem_pio2 js___ieee754_rem_pio2
76 #define __ieee754_remainder js___ieee754_remainder
77 #define __ieee754_scalb js___ieee754_scalb
78 #define __ieee754_sinh js___ieee754_sinh
79 #define __ieee754_sqrt js___ieee754_sqrt
80 #define __ieee754_y0 js___ieee754_y0
81 #define __ieee754_y1 js___ieee754_y1
82 #define __ieee754_yn js___ieee754_yn
83 #define __kernel_cos js___kernel_cos
84 #define __kernel_rem_pio2 js___kernel_rem_pio2
85 #define __kernel_sin js___kernel_sin
86 #define __kernel_standard js___kernel_standard
87 #define __kernel_tan js___kernel_tan
88 #define fd_acos js_fd_acos
89 #define fd_acosh js_fd_acosh
90 #define fd_asin js_fd_asin
91 #define fd_asinh js_fd_asinh
92 #define fd_atan js_fd_atan
93 #define fd_atan2 js_fd_atan2
94 #define fd_atanh js_fd_atanh
95 #define fd_cbrt js_fd_cbrt
96 #define fd_ceil js_fd_ceil
97 #define fd_copysign js_fd_copysign
98 #define fd_cos js_fd_cos
99 #define fd_cosh js_fd_cosh
100 #define fd_erf js_fd_erf
101 #define fd_erfc js_fd_erfc
102 #define fd_exp js_fd_exp
103 #define fd_expm1 js_fd_expm1
104 #define fd_fabs js_fd_fabs
105 #define fd_finite js_fd_finite
106 #define fd_floor js_fd_floor
107 #define fd_fmod js_fd_fmod
108 #define fd_frexp js_fd_frexp
109 #define fd_gamma js_fd_gamma
110 #define fd_hypot js_fd_hypot
111 #define fd_ilogb js_fd_ilogb
112 #define fd_isnan js_fd_isnan
113 #define fd_j0 js_fd_j0
114 #define fd_j1 js_fd_j1
115 #define fd_jn js_fd_jn
116 #define fd_ldexp js_fd_ldexp
117 #define fd_lgamma js_fd_lgamma
118 #define fd_log js_fd_log
119 #define fd_log10 js_fd_log10
120 #define fd_log1p js_fd_log1p
121 #define fd_logb js_fd_logb
122 #define fd_matherr js_fd_matherr
123 #define fd_modf js_fd_modf
124 #define fd_nextafter js_fd_nextafter
125 #define fd_pow js_fd_pow
126 #define fd_remainder js_fd_remainder
127 #define fd_rint js_fd_rint
128 #define fd_scalb js_fd_scalb
129 #define fd_scalbn js_fd_scalbn
130 #define fd_sin js_fd_sin
131 #define fd_sinh js_fd_sinh
132 #define fd_sqrt js_fd_sqrt
133 #define fd_tan js_fd_tan
134 #define fd_tanh js_fd_tanh
135 #define fd_y0 js_fd_y0
136 #define fd_y1 js_fd_y1
137 #define fd_yn js_fd_yn
138 #define gamma_r js_gamma_r
139 #define lgamma_r js_lgamma_r
140 #define significand js_significand
141 #endif
142
143 /* Modified defines start here.. */
144 #undef __LITTLE_ENDIAN
145
146 #ifdef _WIN32
147 #define huge myhuge
148 #define __LITTLE_ENDIAN
149 #endif
150
151 #ifdef XP_OS2
152 #define __LITTLE_ENDIAN
153 #endif
154
155 #if defined(linux) && (defined(__i386__) || defined(__x86_64__) || defined(__ia64))
156 #define __LITTLE_ENDIAN
157 #endif
158
159 /* End here. The rest is the standard file. */
160
161 #ifdef SOLARIS /* special setup for Sun test regime */
162 #if defined(i386) || defined(i486) || \
163 defined(intel) || defined(x86) || defined(i86pc)
164 #define __LITTLE_ENDIAN
165 #endif
166 #endif
167
168 typedef union {
169 #ifdef __LITTLE_ENDIAN
170 struct { int lo, hi; } ints;
171 #else
172 struct { int hi, lo; } ints;
173 #endif
174 double d;
175 } fd_twoints;
176
177 #define __HI(x) x.ints.hi
178 #define __LO(x) x.ints.lo
179
180 #undef __P
181 #ifdef __STDC__
182 #define __P(p) p
183 #else
184 #define __P(p) ()
185 #endif
186
187 /*
188 * ANSI/POSIX
189 */
190
191 extern int signgam;
192
193 #define MAXFLOAT ((float)3.40282346638528860e+38)
194
195 enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
196
197 #define _LIB_VERSION_TYPE enum fdversion
198 #define _LIB_VERSION _fdlib_version
199
200 /* if global variable _LIB_VERSION is not desirable, one may
201 * change the following to be a constant by:
202 * #define _LIB_VERSION_TYPE const enum version
203 * In that case, after one initializes the value _LIB_VERSION (see
204 * s_lib_version.c) during compile time, it cannot be modified
205 * in the middle of a program
206 */
207 extern _LIB_VERSION_TYPE _LIB_VERSION;
208
209 #define _IEEE_ fdlibm_ieee
210 #define _SVID_ fdlibm_svid
211 #define _XOPEN_ fdlibm_xopen
212 #define _POSIX_ fdlibm_posix
213
214 struct exception {
215 int type;
216 char *name;
217 double arg1;
218 double arg2;
219 double retval;
220 };
221
222 #define HUGE MAXFLOAT
223
224 /*
225 * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
226 * (one may replace the following line by "#include <values.h>")
227 */
228
229 #define X_TLOSS 1.41484755040568800000e+16
230
231 #define DOMAIN 1
232 #define SING 2
233 #define OVERFLOW 3
234 #define UNDERFLOW 4
235 #define TLOSS 5
236 #define PLOSS 6
237
238 /*
239 * ANSI/POSIX
240 */
241
242 extern double fd_acos __P((double));
243 extern double fd_asin __P((double));
244 extern double fd_atan __P((double));
245 extern double fd_atan2 __P((double, double));
246 extern double fd_cos __P((double));
247 extern double fd_sin __P((double));
248 extern double fd_tan __P((double));
249
250 extern double fd_cosh __P((double));
251 extern double fd_sinh __P((double));
252 extern double fd_tanh __P((double));
253
254 extern double fd_exp __P((double));
255 extern double fd_frexp __P((double, int *));
256 extern double fd_ldexp __P((double, int));
257 extern double fd_log __P((double));
258 extern double fd_log10 __P((double));
259 extern double fd_modf __P((double, double *));
260
261 extern double fd_pow __P((double, double));
262 extern double fd_sqrt __P((double));
263
264 extern double fd_ceil __P((double));
265 extern double fd_fabs __P((double));
266 extern double fd_floor __P((double));
267 extern double fd_fmod __P((double, double));
268
269 extern double fd_erf __P((double));
270 extern double fd_erfc __P((double));
271 extern double fd_gamma __P((double));
272 extern double fd_hypot __P((double, double));
273 extern int fd_isnan __P((double));
274 extern int fd_finite __P((double));
275 extern double fd_j0 __P((double));
276 extern double fd_j1 __P((double));
277 extern double fd_jn __P((int, double));
278 extern double fd_lgamma __P((double));
279 extern double fd_y0 __P((double));
280 extern double fd_y1 __P((double));
281 extern double fd_yn __P((int, double));
282
283 extern double fd_acosh __P((double));
284 extern double fd_asinh __P((double));
285 extern double fd_atanh __P((double));
286 extern double fd_cbrt __P((double));
287 extern double fd_logb __P((double));
288 extern double fd_nextafter __P((double, double));
289 extern double fd_remainder __P((double, double));
290 #ifdef _SCALB_INT
291 extern double fd_scalb __P((double, int));
292 #else
293 extern double fd_scalb __P((double, double));
294 #endif
295
296 extern int fd_matherr __P((struct exception *));
297
298 /*
299 * IEEE Test Vector
300 */
301 extern double significand __P((double));
302
303 /*
304 * Functions callable from C, intended to support IEEE arithmetic.
305 */
306 extern double fd_copysign __P((double, double));
307 extern int fd_ilogb __P((double));
308 extern double fd_rint __P((double));
309 extern double fd_scalbn __P((double, int));
310
311 /*
312 * BSD math library entry points
313 */
314 extern double fd_expm1 __P((double));
315 extern double fd_log1p __P((double));
316
317 /*
318 * Reentrant version of gamma & lgamma; passes signgam back by reference
319 * as the second argument; user must allocate space for signgam.
320 */
321 #ifdef _REENTRANT
322 extern double gamma_r __P((double, int *));
323 extern double lgamma_r __P((double, int *));
324 #endif /* _REENTRANT */
325
326 /* ieee style elementary functions */
327 extern double __ieee754_sqrt __P((double));
328 extern double __ieee754_acos __P((double));
329 extern double __ieee754_acosh __P((double));
330 extern double __ieee754_log __P((double));
331 extern double __ieee754_atanh __P((double));
332 extern double __ieee754_asin __P((double));
333 extern double __ieee754_atan2 __P((double,double));
334 extern double __ieee754_exp __P((double));
335 extern double __ieee754_cosh __P((double));
336 extern double __ieee754_fmod __P((double,double));
337 extern double __ieee754_pow __P((double,double));
338 extern double __ieee754_lgamma_r __P((double,int *));
339 extern double __ieee754_gamma_r __P((double,int *));
340 extern double __ieee754_lgamma __P((double));
341 extern double __ieee754_gamma __P((double));
342 extern double __ieee754_log10 __P((double));
343 extern double __ieee754_sinh __P((double));
344 extern double __ieee754_hypot __P((double,double));
345 extern double __ieee754_j0 __P((double));
346 extern double __ieee754_j1 __P((double));
347 extern double __ieee754_y0 __P((double));
348 extern double __ieee754_y1 __P((double));
349 extern double __ieee754_jn __P((int,double));
350 extern double __ieee754_yn __P((int,double));
351 extern double __ieee754_remainder __P((double,double));
352 extern int __ieee754_rem_pio2 __P((double,double*));
353 #ifdef _SCALB_INT
354 extern double __ieee754_scalb __P((double,int));
355 #else
356 extern double __ieee754_scalb __P((double,double));
357 #endif
358
359 /* fdlibm kernel function */
360 extern double __kernel_standard __P((double,double,int,int*));
361 extern double __kernel_sin __P((double,double,int));
362 extern double __kernel_cos __P((double,double));
363 extern double __kernel_tan __P((double,double,int));
364 extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));

  ViewVC Help
Powered by ViewVC 1.1.24