ROOTPWA
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
relampl
TFracNum.h
Go to the documentation of this file.
1
#ifndef TFracNum_h
2
#define TFracNum_h
3
13
//
14
// Uncomment the following line
15
// if you want to work in CINT (root.cern.ch)
16
//
17
//#define __JCINT__
18
#ifndef __JCINT__
19
#define Int_t long long
20
#define Double_t double
21
#define Bool_t bool
22
#endif
23
24
#include "
Primes.h
"
25
26
#ifndef __JCINT__
27
const
Int_t
MAXPRIMSQUARED
=
PRIMES
[
NPRIMFIELD
-1]*
PRIMES
[
NPRIMFIELD
-1]*1000;
28
const
char
IOUTSTRING
[5]=
"%lld"
;
29
#else
30
const
Int_t
MAXPRIMSQUARED
=
PRIMES
[
NPRIMFIELD
-1]*
PRIMES
[
NPRIMFIELD
-1];
31
const
char
IOUTSTRING
[3]=
"%d"
;
32
#endif
33
34
//
35
// Fractional number representation by the prime number
36
// decomposition of the nominator and the denominator
37
//
38
class
TFracNum
{
39
40
private
:
41
//
42
// since Num is appearing as short form of "Number",
43
// nom/NOM is taken when the numerator is meant
44
//
45
// maximum prime index of numerator.
46
Int_t
maxPrimNom
;
47
48
// maximum prime index of denominator.
49
Int_t
maxPrimDen
;
50
51
// Prime number decomposition of numerator. Field length is maxPrimNom,
52
// NOM[0] is the exponent of 2, NOM[1] of 3, and so on.
53
Int_t
*
NOM
;
54
// Prime number decomposition of denominator, analogue to NOM
55
Int_t
*
DEN
;
56
57
// Prefactor, including sign
58
// Negative fractional number have sign_prefrac=-1
59
// Special cases:
60
// Division by zero (<=> infinity) => sign_prefac=-7777
61
// Division zero by zero (<=> undetermined) => sign_prefac=-6666
62
Int_t
sign_prefac
;
63
64
// Integers of numerator and denominator
65
Int_t
NOM_INT
;
66
Int_t
DEN_INT
;
67
Double_t
dvalue
;
68
69
public
:
71
TFracNum
(){
72
maxPrimNom
=0;
73
maxPrimDen
=0;
74
NOM
=0;
75
DEN
=0;
76
sign_prefac
=1;
77
};
78
80
TFracNum
(
82
Int_t
mN,
84
Int_t
mD,
86
Int_t
* N,
88
Int_t
*
D
,
96
Int_t
s);
97
99
TFracNum
(
101
Int_t
inom,
103
Int_t
iden);
104
106
108
TFracNum
(
110
Int_t
N,
112
Int_t
D
,
115
const
char
* s);
116
118
Int_t
DenomCommonDivisor
(
const
TFracNum
&)
const
;
119
121
123
TFracNum
*
SumSignedRoots
(
TFracNum
*);
124
126
const
char
*
FracString
();
127
129
131
const
char
*
FracStringSqrt
();
132
134
Double_t
Print
()
const
;
135
137
Double_t
PrintToErr
()
const
;
138
140
Double_t
Dval
(){
return
dvalue
;};
141
143
145
Bool_t
Sqrt
();
146
148
Bool_t
FlipSign
();
149
151
Bool_t
Abs
();
152
154
Bool_t
Invert
();
155
157
Int_t
GetSign
();
158
160
Int_t
GetNumerator
(){
return
NOM_INT
;};
161
163
Int_t
GetDenominator
(){
return
DEN_INT
;};
164
166
Bool_t
PrintDifference
(
const
TFracNum
&)
const
;
167
169
char
*
HeaderString
();
170
172
Bool_t
operator==
(
const
TFracNum
&)
const
;
174
Bool_t
operator>
(
const
TFracNum
&)
const
;
176
TFracNum
operator*
(
const
TFracNum
&)
const
;
178
TFracNum
operator+
(
const
TFracNum
&)
const
;
179
180
Bool_t
SetINTs
();
181
//ClassDef(TFracNum,1);
182
183
};
184
185
const
TFracNum
TFracNum_Zero
( 0,1);
186
const
TFracNum
TFracNum_One
( 1,1);
187
const
TFracNum
TFracNum_Two
( 2,1);
188
const
TFracNum
TFracNum_mTwo
(-2,1);
189
const
TFracNum
TFracNum_Half
( 1,2);
190
const
TFracNum
TFracNum_Quarter
( 1,4);
191
192
TFracNum
am0_to_J
(
Int_t
J,
Int_t
m,
Int_t
m0);
193
TFracNum
c_sub_ell
(
Int_t
ell);
194
TFracNum
cm0_sub_ell
(
Int_t
ell,
Int_t
m0);
195
TFracNum
cm0_sub_ell_2
(
Int_t
ell,
Int_t
m0);
196
197
#endif
Generated by
1.8.1.2