1 #ifndef PhysicsTools_Utilities_Fraction_h
2 #define PhysicsTools_Utilities_Fraction_h
10 template <
int n,
int m>
12 static_assert(
m != 0);
15 operator double()
const {
return double(
n) / double(
m); }
17 double operator()(
double,
double)
const {
return double(
n) / double(
m); }
20 template <
int n,
int m,
unsigned gcd = std::gcd(
n,
m),
int num =
n / gcd,
int den =
m / gcd>
25 template <
int n,
int m,
unsigned gcd,
int num>
30 template <
int n,
int m,
bool pn = (n >= 0),
bool pm = (
m >= 0)>
35 template <
int n,
int m>
41 template <
int n,
int m>
47 template <
int n,
int m>
52 template <
int n,
int m>
57 template <
int n,
int m>
62 template <
int a,
int b,
int c>
68 template <
int a,
int b,
int c>
74 template <
int a,
int b,
int c>
80 template <
int a,
int b,
int c>
86 template <
int a,
int b,
int c>
92 template <
int a,
int b,
int c>
98 template <
int a,
int b,
int c>
104 template <
int a,
int b,
int c,
int d>
108 return fract<a * d + c * b, b * d>();
112 template <
int a,
int b,
int c,
int d>
120 template <
int a,
int b,
int c,
int d>
124 return fract<a * c, b * d>();
128 template <
int a,
int b,
int c,
int d>
132 return fract<a * d, b * c>();
Fraction< a *c, b >::type type
const Numerical< n > & num()
Fraction< a *c-b, b >::type type
const edm::EventSetup & c
static type combine(const Numerical< a > &, const FractionStruct< b, c > &)
static type combine(const Numerical< a > &, const FractionStruct< b, c > &)
static type combine(const FractionStruct< b, c > &, const Numerical< a > &)
Minus< typename PositiveFraction<-n, m >::type >::type type
FractionStruct< num, den > type
static const int denominator
static type combine(const Numerical< n > &, const Numerical< m > &)
static type combine(const Numerical< a > &, const FractionStruct< b, c > &)
static type combine(const Numerical< a > &, const FractionStruct< b, c > &)
static type combine(const FractionStruct< a, b > &, const FractionStruct< c, d > &)
Minus< typename PositiveFraction<-n,-m >::type >::type type
Fraction< a *c, b *d >::type type
Fraction< a *d+c *b, b *d >::type type
PositiveFraction< n, m >::type type
Fraction< a *d, b *c >::type type
Fraction< b, a *c >::type type
const Fraction< n, m >::type & fract()
static const int numerator
Fraction< a *b, c >::type type
static type combine(const FractionStruct< a, b > &, const FractionStruct< c, d > &)
static type combine(const FractionStruct< a, b > &, const FractionStruct< c, d > &)
double operator()(double, double) const
Fraction< a *c+b, b >::type type
Fraction< n, m >::type type
Minus< typename PositiveFraction< n,-m >::type >::type type
static type combine(const FractionStruct< a, b > &, const FractionStruct< c, d > &)
Fraction< a *b, c >::type type
Fraction< a *d-c *b, b *d >::type type
double operator()() const
static type combine(const FractionStruct< b, c > &, const Numerical< a > &)
double operator()(double) const
static type combine(const FractionStruct< b, c > &, const Numerical< a > &)
Fraction< a *c+b, b >::type type