d2::image::get_*bl(): Always return a single value.
[Ale.git] / ale_math.h
blob12029c41c0de669f58b1ecdd43434d954c525b33
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 #ifndef isnan
43 # define isnan(x) ale_isnan(x)
44 static inline int ale_isnan(float x) { return x != x; }
45 static inline int ale_isnan(double x) { return x != x; }
46 static inline int ale_isnan(long double x) { return x != x; }
47 #endif
49 #ifndef isinf
50 # define isinf(x) ale_isinf(x)
51 static inline int ale_isinf(float x) { return isnan (x - x); }
52 static inline int ale_isinf(double x) { return isnan (x - x); }
53 static inline int ale_isinf(long double x) { return isnan (x - x); }
54 #endif
56 #endif