libmesh_augment_std_namespace.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_LIBMESH_AUGMENT_STD_NAMESPACE_H
21 #define LIBMESH_LIBMESH_AUGMENT_STD_NAMESPACE_H
22 
23 
24 // For some reason the real std::max, std::min
25 // don't handle mixed compatible types
26 namespace std {
27  inline long double max(long double a, double b)
28  { return (a>b?a:b); }
29  inline long double min(long double a, double b)
30  { return (a<b?a:b); }
31 
32  inline long double max(double a, long double b)
33  { return (a>b?a:b); }
34  inline long double min(double a, long double b)
35  { return (a<b?a:b); }
36 
37  inline double max(double a, float b)
38  { return (a>b?a:b); }
39  inline double min(double a, float b)
40  { return (a<b?a:b); }
41 
42  inline double max(float a, double b)
43  { return (a>b?a:b); }
44  inline double min(float a, double b)
45  { return (a<b?a:b); }
46 
47  inline long double max(long double a, float b)
48  { return (a>b?a:b); }
49  inline long double min(long double a, float b)
50  { return (a<b?a:b); }
51 
52  inline long double max(float a, long double b)
53  { return (a>b?a:b); }
54  inline long double min(float a, long double b)
55  { return (a<b?a:b); }
56 
57  // fix for std::abs() overload ambiguity
58 #if defined (__SUNPRO_CC) || defined(__PGI)
59  inline double abs(double a)
60  { return ::fabs(a); }
61 
62 #endif
63 
64  // fix for std::pow() overload ambiguity
65 #if defined (__SUNPRO_CC)
66  inline double pow(double a, int b)
67  { return std::pow(a, static_cast<double>(b)); }
68 #endif
69 }
70 
71 #endif // #define LIBMESH_LIBMESH_AUGMENT_STD_NAMESPACE_H

Site Created By: libMesh Developers
Last modified: February 07 2014 16:57:05 UTC

Hosted By:
SourceForge.net Logo