3
* \brief \todo brief description
8
* Copyright ?-? authors
10
* This library is free software; you can redistribute it and/or
11
* modify it either under the terms of the GNU Lesser General Public
12
* License version 2.1 as published by the Free Software Foundation
13
* (the "LGPL") or, at your option, under the terms of the Mozilla
14
* Public License Version 1.1 (the "MPL"). If you do not alter this
15
* notice, a recipient may use your version of this file under either
16
* the MPL or the LGPL.
18
* You should have received a copy of the LGPL along with this library
19
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
* You should have received a copy of the MPL along with this library
22
* in the file COPYING-MPL-1.1
24
* The contents of this file are subject to the Mozilla Public License
25
* Version 1.1 (the "License"); you may not use this file except in
26
* compliance with the License. You may obtain a copy of the License at
27
* http://www.mozilla.org/MPL/
29
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
30
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
31
* the specific language governing rights and limitations.
35
#ifndef _2GEOM_ISNAN_H__
36
#define _2GEOM_ISNAN_H__
5
39
* Temporary fix for various misdefinitions of isnan().
17
51
* Released under GNU GPL, read the file 'COPYING' for more information
19
* 2005 modification hereby placed in public domain. Probably supercedes the 2004 copyright
20
* for the code itself.
53
* 2005 modification hereby placed in public domain. Probably supercedes
54
* the 2004 copyright for the code itself.
24
58
/* You might try changing the above to <cmath> if you have problems.
25
59
* Whether you use math.h or cmath, you may need to edit the .cpp file
26
60
* and/or other .h files to use the same header file.
29
63
#if defined(__isnan)
30
# define is_nan(_a) (__isnan(_a))
64
# define IS_NAN(_a) (__isnan(_a))
31
65
#elif defined(__APPLE__) && __GNUC__ == 3
32
# define is_nan(_a) (__isnan(_a)) /* MacOSX/Darwin definition < 10.4 */
66
# define IS_NAN(_a) (__isnan(_a)) /* MacOSX/Darwin definition < 10.4 */
33
67
#elif defined(WIN32) || defined(_isnan)
34
# define is_nan(_a) (_isnan(_a)) /* Win32 definition */
35
#elif defined(isnan) || defined(__FreeBSD__)
36
# define is_nan(_a) (isnan(_a)) /* GNU definition */
68
# define IS_NAN(_a) (_isnan(_a)) /* Win32 definition */
69
#elif defined(isnan) || defined(__FreeBSD__) || defined(__osf__)
70
# define IS_NAN(_a) (isnan(_a)) /* GNU definition */
71
#elif defined (SOLARIS_2_8) && __GNUC__ == 3 && __GNUC_MINOR__ == 2
72
# define IS_NAN(_a) (isnan(_a)) /* GNU definition */
38
# define is_nan(_a) (std::isnan(_a))
74
# define IS_NAN(_a) (std::isnan(_a))
40
76
/* If the above doesn't work, then try (a != a).
41
77
* Also, please report a bug as per http://www.inkscape.org/report_bugs.php,
46
82
#if defined(__isfinite)
47
# define is_finite(_a) (__isfinite(_a))
83
# define IS_FINITE(_a) (__isfinite(_a))
48
84
#elif defined(__APPLE__) && __GNUC__ == 3
49
# define is_finite(_a) (__isfinite(_a)) /* MacOSX/Darwin definition < 10.4 */
85
# define IS_FINITE(_a) (__isfinite(_a)) /* MacOSX/Darwin definition < 10.4 */
87
# define IS_FINITE(_a) (_isfinite(_a))
50
88
#elif defined(isfinite)
51
# define is_finite(_a) (isfinite(_a))
89
# define IS_FINITE(_a) (isfinite(_a))
90
#elif defined(__osf__)
91
# define IS_FINITE(_a) (finite(_a) && !IS_NAN(_a))
92
#elif defined (SOLARIS_2_8) && __GNUC__ == 3 && __GNUC_MINOR__ == 2
94
#define IS_FINITE(_a) (finite(_a) && !IS_NAN(_a))
53
# define is_finite(_a) (std::isfinite(_a))
96
# define IS_FINITE(_a) (std::isfinite(_a))
55
/* If the above doesn't work, then try (finite(_a) && !isNaN(_a)) or (!isNaN((_a) - (_a))).
98
/* If the above doesn't work, then try (finite(_a) && !IS_NAN(_a)) or
99
* (!IS_NAN((_a) - (_a))).
56
100
* Also, please report a bug as per http://www.inkscape.org/report_bugs.php,
57
101
* giving information about what platform and compiler version you're using.
61
#endif /* __ISNAN_H__ */
105
#endif /* _2GEOM_ISNAN_H__ */
110
c-file-style:"stroustrup"
111
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
116
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :