blob: bdc2dc3416bad042fc92e019ec1cd82dda9a8c46 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1998-2003 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any 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
49void mlib_sincosf (float x, float *s, float *c);
50#define mlib_sqrtf mlib_sqrtf_cafe
51#define mlib_fabsf fabsf
52
53double mlib_sqrt_cafe (double x);
54float 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
64void 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
85double mlib_sincospi(double x, double *co);
86double mlib_atan2i (int y, int x);
87int mlib_ilogb (double x);
88
89#endif /* MLIB_SYSMATH_H */