PSCF v1.1
Classes | Functions
Mathematics

Mathematical constants and utilities. More...

Classes

class  Util::Binomial
 Class for binomial coefficients (all static members) More...
 
class  Util::CardinalBSpline
 A cardinal B-spline basis function. More...
 
class  Util::Constants
 Mathematical constants. More...
 
class  Util::Polynomial< T >
 A Polynomial (i.e,. More...
 
class  Util::Rational
 A Rational number (a ratio of integers). More...
 

Functions

bool Util::feq (double x, double y, double eps=1.0E-10)
 Are two floating point numbers equal to within round-off error? More...
 
int Util::gcd (int a, int b)
 Compute greatest common divisor (gcd) of two integers. More...
 

Detailed Description

Mathematical constants and utilities.

Function Documentation

◆ feq()

bool Util::feq ( double  x,
double  y,
double  eps = 1.0E-10 
)
inline

Are two floating point numbers equal to within round-off error?

Returns true if eps > fabs(x-y)*c/(fabs(x)+fabs(y)+c), c=1.05E-5.

Parameters
xfirst real argument
ysecond real argument
epsmaximum tolerance for nominally "equal" values
Returns
true if equal to within tolerance, false otherwise

Definition at line 27 of file feq.h.

Referenced by Util::Distribution::loadParameters(), Util::RadialDistribution::loadParameters(), and Util::Distribution::serialize().

◆ gcd()

int Util::gcd ( int  a,
int  b 
)
inline

Compute greatest common divisor (gcd) of two integers.

Uses Euclidean algorithm to compute gcd. Always returns a non-negative integer. If one argument is zero, the absolute value of the other is returned. Returns zero if and only if both integers are zero.

Parameters
a1st integer
b2nd integer
Returns
greatest common divisor of a and b

Definition at line 30 of file gcd.h.