annotate src/libm/math.h @ 4870:d275c95ddc05

Added atan2 implementation from uClibc
author Sam Lantinga <slouken@libsdl.org>
date Sun, 29 Aug 2010 16:05:34 -0700
parents f7b03b6838cb
children 67ad1c88dda0
rev   line source
2756
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
3697
f7b03b6838cb Fixed bug #926
Sam Lantinga <slouken@libsdl.org>
parents: 3012
diff changeset
3 Copyright (C) 1997-2010 Sam Lantinga
2756
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
3012
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
23 #include "SDL_stdinc.h"
2756
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24
2760
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2759
diff changeset
25 /* Math routines from uClibc: http://www.uclibc.org */
02aa80d7905f Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents: 2759
diff changeset
26
4870
d275c95ddc05 Added atan2 implementation from uClibc
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
27 #ifndef HAVE_ATAN2
d275c95ddc05 Added atan2 implementation from uClibc
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
28 #define __ieee754_atan2 SDL_atan2
d275c95ddc05 Added atan2 implementation from uClibc
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
29 #endif
d275c95ddc05 Added atan2 implementation from uClibc
Sam Lantinga <slouken@libsdl.org>
parents: 3697
diff changeset
30
3012
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
31 #ifdef HAVE_COPYSIGN
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
32 #define copysign SDL_uclibc_copysign
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
33 #else
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
34 #define copysign SDL_copysign
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
35 #endif
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
36
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
37 #ifdef HAVE_COS
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
38 #define cos SDL_uclibc_cos
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
39 #else
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
40 #define cos SDL_cos
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
41 #endif
2769
2a46b5912665 Added missing math.h functionality for SDL_audiocvt.c
Sam Lantinga <slouken@libsdl.org>
parents: 2768
diff changeset
42
3012
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
43 #ifdef HAVE_FABS
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
44 #define fabs SDL_uclibc_fabs
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
45 #else
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
46 #define fabs SDL_fabs
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
47 #endif
2756
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48
3012
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
49 #ifdef HAVE_FLOOR
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
50 #define floor SDL_uclibc_floor
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
51 #else
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
52 #define floor SDL_floor
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
53 #endif
2756
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
3012
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
55 #ifndef HAVE_LOG
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
56 #define __ieee754_log SDL_log
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
57 #endif
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
58
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
59 #ifndef HAVE_POW
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
60 #define __ieee754_pow SDL_pow
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
61 #endif
2756
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62
3012
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
63 #ifdef HAVE_SCALBN
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
64 #define scalbn SDL_uclibc_scalbn
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
65 #else
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
66 #define scalbn SDL_scalbn
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
67 #endif
2769
2a46b5912665 Added missing math.h functionality for SDL_audiocvt.c
Sam Lantinga <slouken@libsdl.org>
parents: 2768
diff changeset
68
3012
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
69 #ifdef HAVE_SIN
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
70 #define sin SDL_uclibc_sin
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
71 #else
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
72 #define sin SDL_sin
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
73 #endif
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
74
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
75 #ifndef HAVE_SQRT
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
76 #define __ieee754_sqrt SDL_sqrt
7e30c2dc7783 Fixed Visual C++ release build for Visual C++ 2005
Sam Lantinga <slouken@libsdl.org>
parents: 2859
diff changeset
77 #endif
2756
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78
a98604b691c8 Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 /* vi: set ts=4 sw=4 expandtab: */