]>
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 | ||
27835353 | 10 | #define CALCSTATS |
11 | //#define FASTWITHROUNDINDERROS | |
12 | ||
62e60107 | 13 | class AliL3FFloat { |
14 | public: | |
27835353 | 15 | AliL3FFloat(Double_t val=0) {Set(val);} |
16 | AliL3FFloat(const AliL3FFloat &f) {Set(f);} | |
17 | virtual ~AliL3FFloat(); | |
18 | ||
19 | AliL3FFloat& operator = (const AliL3FFloat &f) {Set(f); return *this;} | |
20 | AliL3FFloat& operator = (const Double_t f) {Set(f); return *this;} | |
62e60107 | 21 | |
62e60107 | 22 | operator const Double_t () const {return fVal;} |
27835353 | 23 | operator const Float_t () const {return (Float_t)fVal;} |
24 | operator const Int_t () const {return (Int_t)fVal;} | |
25 | ||
62e60107 | 26 | friend ostream& operator<<(ostream &os, const AliL3FFloat &f); |
27835353 | 27 | |
62e60107 | 28 | friend AliL3FFloat operator + (const AliL3FFloat &f1,const AliL3FFloat &f2); |
29 | friend AliL3FFloat operator + (const AliL3FFloat &f1,const Double_t f2); | |
30 | friend AliL3FFloat operator + (const Double_t f1, const AliL3FFloat &f2); | |
31 | friend AliL3FFloat operator + (const AliL3FFloat &f1); | |
32 | friend AliL3FFloat operator - (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
33 | friend AliL3FFloat operator - (const AliL3FFloat &f1,const Double_t f2); | |
34 | friend AliL3FFloat operator - (const Double_t f1, const AliL3FFloat &f2); | |
35 | friend AliL3FFloat operator - (const AliL3FFloat &f1); | |
36 | friend AliL3FFloat operator * (const AliL3FFloat &f1,const AliL3FFloat &f2); | |
27835353 | 37 | friend AliL3FFloat operator * (const AliL3FFloat &f1,const Double_t f2); |
38 | friend AliL3FFloat operator * (const Double_t f1, const AliL3FFloat &f2); | |
62e60107 | 39 | friend AliL3FFloat operator / (const AliL3FFloat &f1,const AliL3FFloat &f2); |
27835353 | 40 | friend AliL3FFloat operator / (const AliL3FFloat &f1,const Double_t f2); |
41 | friend AliL3FFloat operator / (const Double_t f1, const AliL3FFloat &f2); | |
62e60107 | 42 | |
43 | AliL3FFloat& operator += (const AliL3FFloat &f); | |
44 | AliL3FFloat& operator += (const Double_t f); | |
45 | AliL3FFloat& operator -= (const AliL3FFloat &f); | |
46 | AliL3FFloat& operator -= (const Double_t f); | |
47 | AliL3FFloat& operator *= (const AliL3FFloat &f); | |
48 | AliL3FFloat& operator *= (const Double_t f); | |
49 | AliL3FFloat& operator /= (const AliL3FFloat &f); | |
50 | AliL3FFloat& operator /= (const Double_t f); | |
51 | ||
27835353 | 52 | //==,!=,>=, ... |
53 | //++,-- | |
54 | ||
62e60107 | 55 | static void PrintStat(); |
56 | static void SetParams(Int_t dig=DEFDIG,Int_t min=DEFMIN,Int_t max=DEFMAX); | |
57 | void Set(Double_t f=0); | |
58 | void Set(AliL3FFloat &f); | |
59 | inline Double_t GetVal() const {return fVal;} | |
60 | inline Double_t GetExactVal() const {return fExactVal;} | |
61 | ||
62 | private: | |
63 | ||
64 | Double_t Round(Double_t f); | |
65 | Bool_t CheckUpperBound(); | |
66 | Bool_t CheckLowerBound(); | |
67 | Bool_t CheckBounds() {return (CheckUpperBound() && CheckLowerBound());} | |
68 | ||
69 | Double_t fVal; | |
70 | Double_t fExactVal; | |
71 | ||
72 | static Int_t fDigits; | |
27835353 | 73 | static Char_t fQuery[10]; |
62e60107 | 74 | static Int_t fMax; |
75 | static Int_t fMin; | |
76 | ||
27835353 | 77 | #ifdef CALCSTATS |
62e60107 | 78 | static Int_t fN; |
79 | static Int_t fNRounded; | |
80 | static Int_t fNOpAdds; | |
81 | static Int_t fNOpMults; | |
82 | static Int_t fNOpDivs; | |
83 | static Int_t fNOpSubs; | |
84 | static Int_t fNOverFlow; | |
85 | static Int_t fNUnderFlow; | |
27835353 | 86 | static Double_t fNDiff; |
87 | #endif | |
62e60107 | 88 | |
89 | ClassDef(AliL3FFloat,1) | |
90 | }; | |
91 | ||
92 | #endif | |
93 | ||
94 | ||
95 | ||
96 | ||
97 |