]>
Commit | Line | Data |
---|---|---|
62e60107 | 1 | #ifndef ALIL3FFLOAT_H |
2 | #define ALIL3FFLOAT_H | |
3 | ||
4 | #include "AliL3RootTypes.h" | |
5 | ||
6 | #define DEFDIG 100 | |
7 | #define DEFMIN -1000000 | |
8 | #define DEFMAX 1000000 | |
9 | ||
10 | class AliL3FFloat { | |
11 | public: | |
12 | AliL3FFloat(Double_t val=0) {Set(val);} | |
13 | AliL3FFloat(AliL3FFloat &f) {Set(f); } | |
14 | ||
15 | operator const Float_t () const {return (Float_t)fVal;} | |
16 | operator const Double_t () const {return fVal;} | |
17 | friend ostream& operator<<(ostream &os, const AliL3FFloat &f); | |
18 | //AliL3FFloat& operator = (const AliL3FFloat &f) {Set(f); return *this;} | |
19 | //AliL3FFloat& operator = (const Double_t f) {Set(f); return *this;} | |
20 | friend AliL3FFloat operator + (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
21 | friend AliL3FFloat operator + (const AliL3FFloat &f1,const Double_t f2); | |
22 | friend AliL3FFloat operator + (const Double_t f1, const AliL3FFloat &f2); | |
23 | friend AliL3FFloat operator + (const AliL3FFloat &f1); | |
24 | friend AliL3FFloat operator - (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
25 | friend AliL3FFloat operator - (const AliL3FFloat &f1,const Double_t f2); | |
26 | friend AliL3FFloat operator - (const Double_t f1, const AliL3FFloat &f2); | |
27 | friend AliL3FFloat operator - (const AliL3FFloat &f1); | |
28 | friend AliL3FFloat operator * (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
29 | friend AliL3FFloat operator / (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
30 | ||
31 | AliL3FFloat& operator += (const AliL3FFloat &f); | |
32 | AliL3FFloat& operator += (const Double_t f); | |
33 | AliL3FFloat& operator -= (const AliL3FFloat &f); | |
34 | AliL3FFloat& operator -= (const Double_t f); | |
35 | AliL3FFloat& operator *= (const AliL3FFloat &f); | |
36 | AliL3FFloat& operator *= (const Double_t f); | |
37 | AliL3FFloat& operator /= (const AliL3FFloat &f); | |
38 | AliL3FFloat& operator /= (const Double_t f); | |
39 | ||
40 | static void PrintStat(); | |
41 | static void SetParams(Int_t dig=DEFDIG,Int_t min=DEFMIN,Int_t max=DEFMAX); | |
42 | void Set(Double_t f=0); | |
43 | void Set(AliL3FFloat &f); | |
44 | inline Double_t GetVal() const {return fVal;} | |
45 | inline Double_t GetExactVal() const {return fExactVal;} | |
46 | ||
47 | private: | |
48 | ||
49 | Double_t Round(Double_t f); | |
50 | Bool_t CheckUpperBound(); | |
51 | Bool_t CheckLowerBound(); | |
52 | Bool_t CheckBounds() {return (CheckUpperBound() && CheckLowerBound());} | |
53 | ||
54 | Double_t fVal; | |
55 | Double_t fExactVal; | |
56 | ||
57 | static Int_t fDigits; | |
58 | static Int_t fMax; | |
59 | static Int_t fMin; | |
60 | ||
61 | static Int_t fN; | |
62 | static Int_t fNRounded; | |
63 | static Int_t fNOpAdds; | |
64 | static Int_t fNOpMults; | |
65 | static Int_t fNOpDivs; | |
66 | static Int_t fNOpSubs; | |
67 | static Int_t fNOverFlow; | |
68 | static Int_t fNUnderFlow; | |
69 | ||
70 | ClassDef(AliL3FFloat,1) | |
71 | }; | |
72 | ||
73 | #endif | |
74 | ||
75 | ||
76 | ||
77 | ||
78 |