1 //==============================================================================
2 //
3 //  This file is part of GPSTk, the GPS Toolkit.
4 //
5 //  The GPSTk is free software; you can redistribute it and/or modify
6 //  it under the terms of the GNU Lesser General Public License as published
7 //  by the Free Software Foundation; either version 3.0 of the License, or
8 //  any later version.
9 //
10 //  The GPSTk is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU Lesser General Public License for more details.
14 //
15 //  You should have received a copy of the GNU Lesser General Public
16 //  License along with GPSTk; if not, write to the Free Software Foundation,
17 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 //  This software was developed by Applied Research Laboratories at the
20 //  University of Texas at Austin.
21 //  Copyright 2004-2020, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 //  This software was developed by Applied Research Laboratories at the
28 //  University of Texas at Austin, under contract to an agency or agencies
29 //  within the U.S. Department of Defense. The U.S. Government retains all
30 //  rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 //  Pursuant to DoD Directive 523024
33 //
34 //  DISTRIBUTION STATEMENT A: This software has been approved for public
35 //                            release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 /// @file MathBase.hpp
40 /// Basic math #defines (ABS, SQRT, etc)
41 
42 #ifndef GPSTK_MATH_BASE_HPP
43 #define GPSTK_MATH_BASE_HPP
44 
45 //@fix MSVC doesnt like std::sqrt or std::abs, and disabling
46 //extensions allows abs(double) to be used instead of fabs()
47 #ifdef _MSC_VER
48 #undef _MSC_EXTENSIONS
49 #endif
50 #include <cmath>
51 #ifdef _MSC_VER
52 #define _MSC_EXTENSIONS
53 #endif
54 
55 #ifdef ABS
56 #undef ABS
57 #endif
58 #ifdef SQRT
59 #undef SQRT
60 #endif
61 #ifdef MAX
62 #undef MAX
63 #endif
64 
65 namespace gpstk
66 {
67 // do Doxygen elsewhere
68 #ifdef _MSC_VER
69 #define ABS(x)  ::abs(x)
70 #define SQRT(x) ::sqrt(x)
71 #define MAX(x,y) std::max(x,y)
72 #else
73 #define ABS(x)  std::abs(x)
74 #define SQRT(x) std::sqrt(x)
75 #define MAX(x,y) std::max(x,y)
76 #endif
77 
78 }  // namespace gpstk
79 #endif
80