1 | /* |
2 | * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. |
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | * |
5 | * This code is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU General Public License version 2 only, as |
7 | * published by the Free Software Foundation. Oracle designates this |
8 | * particular file as subject to the "Classpath" exception as provided |
9 | * by Oracle in the LICENSE file that accompanied this code. |
10 | * |
11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
14 | * version 2 for more details (a copy is included in the LICENSE file that |
15 | * accompanied this code). |
16 | * |
17 | * You should have received a copy of the GNU General Public License version |
18 | * 2 along with this work; if not, write to the Free Software Foundation, |
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
20 | * |
21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 | * or visit www.oracle.com if you need additional information or have any |
23 | * questions. |
24 | */ |
25 | |
26 | |
27 | #ifndef MLIB_SYSMATH_H |
28 | #define MLIB_SYSMATH_H |
29 | |
30 | #include <math.h> |
31 | #ifdef _MSC_VER |
32 | #define M_PI 3.14159265358979323846 |
33 | #define M_1_PI 0.31830988618379067154 |
34 | #endif /* _MSC_VER */ |
35 | |
36 | #define mlib_acos acos |
37 | #define mlib_sin sin |
38 | #define mlib_cos cos |
39 | #define mlib_fabs fabs |
40 | #define mlib_ceil ceil |
41 | |
42 | #ifdef MLIB_LIBCAFEMATH |
43 | |
44 | #include <stdlib.h> |
45 | |
46 | #define mlib_sqrt mlib_sqrt_cafe |
47 | #define mlib_sinf sinf |
48 | #define mlib_cosf cosf |
49 | void mlib_sincosf (float x, float *s, float *c); |
50 | #define mlib_sqrtf mlib_sqrtf_cafe |
51 | #define mlib_fabsf fabsf |
52 | |
53 | double mlib_sqrt_cafe (double x); |
54 | float mlib_sqrtf_cafe (float x); |
55 | |
56 | #else |
57 | |
58 | #define mlib_sqrt sqrt |
59 | |
60 | #ifdef MLIB_NO_LIBSUNMATH |
61 | |
62 | #define mlib_sinf (float) sin |
63 | #define mlib_cosf (float) cos |
64 | void mlib_sincosf (float x, float *s, float *c); |
65 | #define mlib_sqrtf (float) sqrt |
66 | #define mlib_fabsf (float) fabs |
67 | |
68 | #else |
69 | |
70 | #include <sunmath.h> |
71 | |
72 | #define mlib_sinf sinf |
73 | #define mlib_cosf cosf |
74 | #define mlib_sincosf sincosf |
75 | #define mlib_sqrtf sqrtf |
76 | #define mlib_fabsf fabsf |
77 | |
78 | #endif /* MLIB_NO_LIBSUNMATH */ |
79 | |
80 | #endif /* MLIB_LIBCAFEMATH */ |
81 | |
82 | |
83 | /* internal mathematical functions */ |
84 | |
85 | double mlib_sincospi(double x, double *co); |
86 | double mlib_atan2i (int y, int x); |
87 | int mlib_ilogb (double x); |
88 | |
89 | #endif /* MLIB_SYSMATH_H */ |
90 | |