bugs: focus stacking by per-element certainty, determined by frequency characteristics.
[Ale.git] / ale_math.h
blobb1d304b9af6dd22259124a5b9397811a5bfb24bb
1 // Copyright 2002, 2003, 2004, 2005, 2006 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __ale_math_h__
22 #define __ale_math_h__
25 * Certain versions of Mac OSX may disable math.h definitions of is*() macros
26 * when iostream is included, so we include the latter here.
29 #include <math.h>
30 #include <iostream>
33 * isnan() and isinf() code logic are based on those noted in the GNU Autoconf
34 * manual, by the Free Software Foundation:
36 * http://www.gnu.org/software/autoconf/manual/html_node/Function-Portability.html
38 * As C++ is available here, we use C++ overloading instead of sizeof()
39 * switches to handle different types.
42 #define FIXED16 4
43 #define FIXED32 5
46 #if ALE_COLORS == FIXED16 || ALE_COLORS == FIXED32 \
47 || ALE_COORDINATES == FIXED16 || ALE_COORDINATES == FIXED32
50 * Since we need custom isnan and isinf for fixed-point values, we disable any
51 * such macros provided.
54 #undef isnan
55 #undef isinf
57 #endif
59 #undef FIXED16
60 #undef FIXED32
62 #ifndef isnan
63 # define isnan(x) ale_isnan(x)
64 static inline int ale_isnan(float x) { return x != x; }
65 static inline int ale_isnan(double x) { return x != x; }
66 static inline int ale_isnan(long double x) { return x != x; }
67 #endif
69 #ifndef isinf
70 # define isinf(x) ale_isinf(x)
71 static inline int ale_isinf(float x) { return isnan (x - x); }
72 static inline int ale_isinf(double x) { return isnan (x - x); }
73 static inline int ale_isinf(long double x) { return isnan (x - x); }
74 #endif
76 #endif