initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / OpenFOAM / primitives / Scalar / floatScalar / floatScalar.H
blob2532ef130eb7ea4ca808d01636ad14dfdffc1afb
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Typedef
26     Foam::floatScalar
28 Description
29     Float precision floating point scalar type.
31 SourceFiles
32     floatScalar.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef floatScalar_H
37 #define floatScalar_H
39 #include "doubleFloat.H"
40 #include "direction.H"
41 #include "word.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 typedef float floatScalar;
52 // Largest and smallest scalar values allowed in certain parts of the code
53 // (6 is the number of significant figures in an
54 //  IEEE single precision number.  See limits.h or float.h)
55 static const floatScalar floatScalarGREAT = 1.0e+6;
56 static const floatScalar floatScalarVGREAT = 1.0e+37;
57 static const floatScalar floatScalarROOTVGREAT = 1.0e+18;
58 static const floatScalar floatScalarSMALL = 1.0e-6;
59 static const floatScalar floatScalarVSMALL = 1.0e-37;
60 static const floatScalar floatScalarROOTVSMALL = 1.0e-18;
63 #define Scalar floatScalar
64 #define ScalarVSMALL floatScalarVSMALL
65 #define readScalar readFloatScalar
67 inline Scalar mag(const Scalar s)
69     return ::fabsf(s);
72 #define transFunc(func)            \
73 inline Scalar func(const Scalar s) \
74 {                                  \
75     return ::func##f(s);           \
78 #include "Scalar.H"
80 inline Scalar hypot(const Scalar x, const Scalar y)
82     return ::hypotf(x, y);
85 inline Scalar atan2(const Scalar y, const Scalar x)
87     return ::atan2f(y, x);
90 inline Scalar jn(const int n, const Scalar s)
92     return ::jnf(n, s);
95 inline Scalar yn(const int n, const Scalar s)
97     return ::ynf(n, s);
100 #undef Scalar
101 #undef ScalarVSMALL
102 #undef readScalar
103 #undef transFunc
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 } // End namespace Foam
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 #endif
114 // ************************************************************************* //