#include <xmath.h>
List of all members.
Static Public Member Functions |
static double | Inv (const double &x) |
static double | Sqr (const double &x) |
static double | Sqrt (const double &x) |
static double | Log (const double &Val) |
static double | Log2 (const double &Val) |
static double | Round (const double &Val) |
static double | Round (const double &Val, int Decs) |
static int | Fac (const int &Val) |
static int | Choose (const int &N, const int &K) |
static uint | Pow2 (const int &pow) |
static double | Power (const double &Base, const double &Exponent) |
template<typename T > |
static int | Sign (const T &Val) |
template<class T > |
static const T & | Mx (const T &LVal, const T &RVal) |
template<class T > |
static const T & | Mn (const T &LVal, const T &RVal) |
template<class T > |
static const T & | Mx (const T &Val1, const T &Val2, const T &Val3) |
template<class T > |
static const T & | Mn (const T &Val1, const T &Val2, const T &Val3) |
template<class T > |
static const T & | Median (const T &Val1, const T &Val2, const T &Val3) |
template<class T > |
static const T & | InRange (const T &Val, const T &Mn, const T &Mx) |
template<class T > |
static bool | IsInRange (const T &Val, const T &Mn, const T &Mx) |
template<class T > |
static bool | IsInEps (const T &Val, const T &Eps) |
Static Public Attributes |
static double | E = 2.71828182845904523536 |
static double | Pi = 3.14159265358979323846 |
static double | LogOf2 = log(double(2)) |
Detailed Description
Definition at line 5 of file xmath.h.
Member Function Documentation
static int TMath::Choose |
( |
const int & |
N, |
|
|
const int & |
K |
|
) |
| [inline, static] |
static int TMath::Fac |
( |
const int & |
Val | ) |
[inline, static] |
Definition at line 20 of file xmath.h.
{
if (Val<=1){return 1;} else {return Val*Fac(Val-1);}}
template<class T >
static const T& TMath::InRange |
( |
const T & |
Val, |
|
|
const T & |
Mn, |
|
|
const T & |
Mx |
|
) |
| [inline, static] |
static double TMath::Inv |
( |
const double & |
x | ) |
[inline, static] |
template<class T >
static bool TMath::IsInEps |
( |
const T & |
Val, |
|
|
const T & |
Eps |
|
) |
| [inline, static] |
Definition at line 83 of file xmath.h.
{
return Val >= -Eps && Val <= Eps;}
template<class T >
static bool TMath::IsInRange |
( |
const T & |
Val, |
|
|
const T & |
Mn, |
|
|
const T & |
Mx |
|
) |
| [inline, static] |
static double TMath::Log |
( |
const double & |
Val | ) |
[inline, static] |
static double TMath::Log2 |
( |
const double & |
Val | ) |
[inline, static] |
template<class T >
static const T& TMath::Median |
( |
const T & |
Val1, |
|
|
const T & |
Val2, |
|
|
const T & |
Val3 |
|
) |
| [inline, static] |
Definition at line 62 of file xmath.h.
{
if (Val1 < Val2) {
if (Val2 < Val3) return Val2;
else if (Val3 < Val1) return Val1;
else return Val3;
} else {
if (Val1 < Val3) return Val1;
else if (Val3 < Val2) return Val2;
else return Val3;
}
}
template<class T >
static const T& TMath::Mn |
( |
const T & |
LVal, |
|
|
const T & |
RVal |
|
) |
| [inline, static] |
Definition at line 36 of file xmath.h.
{
return LVal < RVal ? LVal : RVal;}
template<class T >
static const T& TMath::Mn |
( |
const T & |
Val1, |
|
|
const T & |
Val2, |
|
|
const T & |
Val3 |
|
) |
| [inline, static] |
Definition at line 51 of file xmath.h.
{
if(Val1 < Val2) {
if (Val1 < Val3) return Val1;
else return Val3;
} else {
if (Val2 < Val3) return Val2;
else return Val3;
}
}
template<class T >
static const T& TMath::Mx |
( |
const T & |
LVal, |
|
|
const T & |
RVal |
|
) |
| [inline, static] |
Definition at line 32 of file xmath.h.
{
return LVal > RVal ? LVal : RVal;}
template<class T >
static const T& TMath::Mx |
( |
const T & |
Val1, |
|
|
const T & |
Val2, |
|
|
const T & |
Val3 |
|
) |
| [inline, static] |
Definition at line 40 of file xmath.h.
{
if (Val1 > Val2) {
if (Val1 > Val3) return Val1;
else return Val3;
} else {
if (Val2 > Val3) return Val2;
else return Val3;
}
}
static double TMath::Power |
( |
const double & |
Base, |
|
|
const double & |
Exponent |
|
) |
| [inline, static] |
Definition at line 25 of file xmath.h.
{
return exp(log(Base)*Exponent);}
static double TMath::Round |
( |
const double & |
Val | ) |
[inline, static] |
Definition at line 16 of file xmath.h.
{
return (Val>0)?floor(Val+0.5):ceil(Val-0.5);}
static double TMath::Round |
( |
const double & |
Val, |
|
|
int |
Decs |
|
) |
| [inline, static] |
Definition at line 18 of file xmath.h.
{
const double pwr=pow(10.0, Decs); return Round(Val * pwr) / pwr;}
template<typename T >
static int TMath::Sign |
( |
const T & |
Val | ) |
[inline, static] |
Definition at line 29 of file xmath.h.
{return Val<0?-1:(Val>0?1:0);}
static double TMath::Sqr |
( |
const double & |
x | ) |
[inline, static] |
static double TMath::Sqrt |
( |
const double & |
x | ) |
[inline, static] |
Member Data Documentation
double TMath::E = 2.71828182845904523536 [static] |
double TMath::Pi = 3.14159265358979323846 [static] |
The documentation for this class was generated from the following files: