glucat 0.13.0
portability.h
Go to the documentation of this file.
1#ifndef _GLUCAT_PORTABILITY_H
2#define _GLUCAT_PORTABILITY_H
3/***************************************************************************
4 GluCat : Generic library of universal Clifford algebra templates
5 portability.h : Work around non-standard compilers and libraries
6 -------------------
7 begin : Sun 2001-08-18
8 copyright : (C) 2001-2016 by Paul C. Leopardi
9 ***************************************************************************
10
11 This library is free software: you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published
13 by the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with this library. If not, see <http://www.gnu.org/licenses/>.
23
24 ***************************************************************************
25 This library is based on a prototype written by Arvind Raja and was
26 licensed under the LGPL with permission of the author. See Arvind Raja,
27 "Object-oriented implementations of Clifford algebras in C++: a prototype",
28 in Ablamowicz, Lounesto and Parra (eds.)
29 "Clifford algebras with numeric and symbolic computations", Birkhauser, 1996.
30 ***************************************************************************
31 See also Arvind Raja's original header comments in glucat.h
32 ***************************************************************************/
33
34#include <boost/version.hpp>
35#include <cmath>
36
37// Workaround for isnan and isinf
38#if __cplusplus > 199711L
39# define _GLUCAT_ISNAN(x) (std::isnan(x))
40# define _GLUCAT_ISINF(x) (std::isinf(x))
41#else
42# define _GLUCAT_ISNAN(x) (x != x)
43# define _GLUCAT_ISINF(x) (!_GLUCAT_ISNAN(x) && _GLUCAT_ISNAN(x-x))
44#endif
45
46// Workaround for abs and sqrt
47#if BOOST_VERSION >= 103400
48# define UBLAS_ABS type_abs
49# define UBLAS_SQRT type_sqrt
50#else
51# define UBLAS_ABS abs
52# define UBLAS_SQRT sqrt
53#endif
54
55// Use with Cygwin gcc to obtain __WORDSIZE
56#if defined(HAVE_BITS_WORDSIZE_H)
57# include <bits/wordsize.h>
58#endif
59
60#endif // _GLUCAT_PORTABILITY_H