1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3
* ***** BEGIN LICENSE BLOCK *****
4
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
16
* The Original Code is Mozilla Communicator client code, released
19
* The Initial Developer of the Original Code is
20
* Netscape Communications Corporation.
21
* Portions created by the Initial Developer are Copyright (C) 1998
22
* the Initial Developer. All Rights Reserved.
27
* Alternatively, the contents of this file may be used under the terms of
28
* either of the GNU General Public License Version 2 or later (the "GPL"),
29
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30
* in which case the provisions of the GPL or the LGPL are applicable instead
31
* of those above. If you wish to allow use of your version of this file only
32
* under the terms of either the GPL or the LGPL, and not to allow others to
33
* use your version of this file under the terms of the MPL, indicate your
34
* decision by deleting the provisions above and replace them with the notice
35
* and other provisions required by the GPL or the LGPL. If you do not delete
36
* the provisions above, a recipient may use your version of this file under
37
* the terms of any one of the MPL, the GPL or the LGPL.
39
* ***** END LICENSE BLOCK ***** */
42
* By default all math calls go to fdlibm. The defines for each platform
43
* remap the math calls to native routines.
53
* Define on which platforms to use fdlibm. Not used by default under
54
* assumption that native math library works unless proved guilty.
55
* Plus there can be problems with endian-ness and such in fdlibm itself.
57
* fdlibm compatibility notes:
58
* - fdlibm broken on OSF1/alpha
61
#ifndef JS_USE_FDLIBM_MATH
62
#define JS_USE_FDLIBM_MATH 0
65
#if !JS_USE_FDLIBM_MATH
68
* Use system provided math routines.
74
#define fd_atan2 atan2
77
/* The right copysign function is not always named the same thing. */
78
#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
79
#define fd_copysign __builtin_copysign
81
#define fd_copysign _copysign
84
/* Try to work around apparent _copysign bustage in VC6 and VC7. */
85
#define fd_copysign js_copysign
86
extern double js_copysign(double, double);
88
#define fd_copysign _copysign
91
#define fd_copysign copysign
97
#define fd_floor floor
108
* Use math routines in fdlibm.
118
#if (defined _WIN32 && !defined WINCE) || defined SUNOS4
131
#define fd_floor floor
134
extern double fd_atan2 __P((double, double));
135
extern double fd_copysign __P((double, double));
136
extern double fd_pow __P((double, double));
145
#define fd_log10 log10
148
#define fd_floor floor
151
extern double fd_cos __P((double));
152
extern double fd_sin __P((double));
153
extern double fd_tan __P((double));
154
extern double fd_atan2 __P((double, double));
155
extern double fd_pow __P((double, double));
156
extern double fd_ceil __P((double));
157
extern double fd_copysign __P((double, double));
159
#elif defined SOLARIS
169
#define fd_floor floor
172
extern double fd_acos __P((double));
173
extern double fd_asin __P((double));
174
extern double fd_log __P((double));
175
extern double fd_atan2 __P((double, double));
176
extern double fd_pow __P((double, double));
177
extern double fd_copysign __P((double, double));
186
#define fd_floor floor
189
extern double fd_ceil __P((double));
190
extern double fd_acos __P((double));
191
extern double fd_log __P((double));
192
extern double fd_atan2 __P((double, double));
193
extern double fd_tan __P((double));
194
extern double fd_pow __P((double, double));
195
extern double fd_asin __P((double));
196
extern double fd_atan __P((double));
197
extern double fd_copysign __P((double, double));
204
#define fd_copysign copysign
213
extern double fd_atan2 __P((double, double));
214
extern double fd_ceil __P((double));
215
extern double fd_floor __P((double));
216
extern double fd_log __P((double));
217
extern double fd_pow __P((double, double));
223
#define fd_atan2 atan2
224
#define fd_copysign copysign
228
#define fd_floor floor
234
extern double fd_atan __P((double));
235
extern double fd_ceil __P((double));
236
extern double fd_pow __P((double,double));
237
extern double fd_tan __P((double));
239
#else /* other platform.. generic paranoid slow fdlibm */
241
extern double fd_acos __P((double));
242
extern double fd_asin __P((double));
243
extern double fd_atan __P((double));
244
extern double fd_cos __P((double));
245
extern double fd_sin __P((double));
246
extern double fd_tan __P((double));
248
extern double fd_exp __P((double));
249
extern double fd_log __P((double));
250
extern double fd_sqrt __P((double));
252
extern double fd_ceil __P((double));
253
extern double fd_fabs __P((double));
254
extern double fd_floor __P((double));
255
extern double fd_fmod __P((double, double));
257
extern double fd_atan2 __P((double, double));
258
extern double fd_pow __P((double, double));
259
extern double fd_copysign __P((double, double));
263
#endif /* JS_USE_FDLIBM_MATH */
265
#endif /* _LIBMATH_H */