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-------------------------------------------------------------------------------
11License
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
39namespace Foam
40{
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44//- Compare two values for equality
45template<class T>
46inline bool equal(const T& s1, const T& s2)
47{
48 return s1 == s2;
49}
50
51
52#define MAXMINPOW(retType, type1, type2) \
53 \
54MAXMIN(retType, type1, type2) \
55 \
56 \
57inline double pow(const type1 base, const type2 expon) \
58{ \
59 return ::pow(double(base), double(expon)); \
60}
61
62
63MAXMINPOW(double, double, double)
64MAXMINPOW(double, double, float)
65MAXMINPOW(double, float, double)
66MAXMINPOW(double, double, int)
67MAXMINPOW(double, int, double)
68MAXMINPOW(double, double, long)
69MAXMINPOW(double, long, double)
70MAXMINPOW(float, float, float)
71MAXMINPOW(float, float, int)
72MAXMINPOW(float, int, float)
73MAXMINPOW(float, float, long)
74MAXMINPOW(float, long, float)
75#if defined(__APPLE__) && WM_LABEL_SIZE == 64
76MAXMINPOW(double, double, int64_t)
77MAXMINPOW(double, int64_t, double)
78MAXMINPOW(float, float, int64_t)
79MAXMINPOW(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// ************************************************************************* //
const volScalarField & T
#define MAXMINPOW(retType, type1, type2)
Definition: doubleFloat.H:52
Namespace for OpenFOAM.
bool equal(const T &s1, const T &s2)
Compare two values for equality.
Definition: doubleFloat.H:46
Traits classes for inner and outer products of primitives.