doubleFloat.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9  Copyright (C) 2018-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #ifndef doubleFloat_H
30 #define doubleFloat_H
31 
32 #include "label.H"
33 #include "products.H"
34 
35 #include <cmath>
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace Foam
40 {
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 //- Compare two values for equality
45 template<class T>
46 inline bool equal(const T& s1, const T& s2)
47 {
48  return s1 == s2;
49 }
50 
51 
52 #define MAXMINPOW(retType, type1, type2) \
53  \
54 MAXMIN(retType, type1, type2) \
55  \
56  \
57 inline double pow(const type1 base, const type2 expon) \
58 { \
59  return ::pow(double(base), double(expon)); \
60 }
61 
62 
63 MAXMINPOW(double, double, double)
64 MAXMINPOW(double, double, float)
65 MAXMINPOW(double, float, double)
66 MAXMINPOW(double, double, int)
67 MAXMINPOW(double, int, double)
68 MAXMINPOW(double, double, long)
69 MAXMINPOW(double, long, double)
70 MAXMINPOW(float, float, float)
71 MAXMINPOW(float, float, int)
72 MAXMINPOW(float, int, float)
73 MAXMINPOW(float, float, long)
74 MAXMINPOW(float, long, float)
75 #if defined(__APPLE__) && WM_LABEL_SIZE == 64
76 MAXMINPOW(double, double, int64_t)
77 MAXMINPOW(double, int64_t, double)
78 MAXMINPOW(float, float, int64_t)
79 MAXMINPOW(float, int64_t, float)
80 #endif
81 
82 #undef MAXMINPOW
83 
84 
85 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
86 
87 } // End namespace Foam
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 #endif
92 
93 // ************************************************************************* //
MAXMINPOW
#define MAXMINPOW(retType, type1, type2)
Definition: doubleFloat.H:52
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
label.H
Foam::equal
bool equal(const T &s1, const T &s2)
Compare two values for equality.
Definition: doubleFloat.H:46
products.H
Traits classes for inner and outer products of primitives.