Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qgar::Math Class Reference
[Math]

#include <qgarlib/math.H>

List of all members.


Detailed Description

Global constants and thresholds, implemented as static data members of the class.

The class is just a collection of constants and therefore cannot be instanciated.

All mathematical constants have been computed using Maple.

Author:
Gérald Masini
Date:
February 21, 2003 17:50
Since:
Qgar 2.0

Definition at line 84 of file math.H.

Static Public Member Functions

Access to thresholds for numeric calculus
static double relError ()
 Get relative error for floating point numeric calculus.
Access to thresholds for (in)equality tests
static double epsilonD ()
 Get threshold for equality tests between double numbers.
static float epsilonF ()
 Get threshold for equality tests between float numbers.
static int epsilonI ()
 Get threshold for equality tests between int numbers.
static double epsilonRadian ()
 Get threshold for equality tests between angles in radians.
static double epsilonDegree ()
 Get threshold for equality tests between angles in degrees.
Set thresholds for numeric calculus
static void setRelError (double aRelError)
 Set relative error for floating point numeric calculus.
Set thresholds for (in)equality tests
static void setEpsilonD (double anEpsilon)
 Set threshold for equality tests between double numbers.
static void setEpsilonF (float anEpsilon)
 Set threshold for equality test between float numbers.
static void setEpsilonI (int anEpsilon)
 Set threshold for equality tests between int numbers.
static void setEpsilonRadian (double anEpsilon)
 Set threshold for equality tests between angles in radians.
static void setEpsilonDegree (double anEpsilon)
 Set threshold for equality tests between angles in degrees.

Static Public Attributes

Constants to preserve compatibility with Windows OS
Most of these constants are defined in math.h<b> when using a Unix/Linux OS, but are not available when using a Windows OS.

static const double QG_DOUBLE_MAX = 1.79769313486231570e+308
 Maximum double number.
static const double QG_DOUBLE_MIN = 4.94065645841246544e-324
 Minimum double number.
static const float QG_FLOAT_MAX = 3.40282346638528860e+38
 Maximum float number.
static const float QG_FLOAT_MIN = 1.40129846432481707e-45
 Minimum float number.
Constants related to e
static const double QG_E = 2.7182818284590452354
 Value of $e$.
static const double QG_LOG2E = 1.4426950408889634074
 Value of $\log_2{e}$.
static const double QG_LOG10E = 0.43429448190325182765
 Value of $\log_{10}{e}$.
static const double QG_LN2 = 0.69314718055994530942
 Value of $\ln{2}$.
static const double QG_LN10 = 2.30258509299404568402
 Value of $\ln{10}$.
Constants related to Pi
static const double QG_2PI = 6.28318530717958647692
 Value of $2\pi$.
static const double QG_PI = 3.14159265358979323846
 Value of $\pi$.
static const double QG_PI_2 = 1.57079632679489661923
 Value of $\frac{\pi}{2}$.
static const double QG_PI_3 = 1.04719755119659774615
 Value of $\frac{\pi}{3}$.
static const double QG_PI_4 = 0.78539816339744830962
 Value of $\frac{\pi}{4}$.
static const double QG_PI_6 = 0.52359877559829887308
 Value of $\frac{\pi}{6}$.
static const double QG_SQRT_2PI = 2.50662827463100050242
 Value of $\sqrt{2\pi}$.
static const double QG_SQRT_PI = 1.77245385090551602730
 Value of $\sqrt{\pi}$.
static const double QG_1_2PI = 0.15915494309189533577
 Value of $\frac{1}{2\pi}$.
static const double QG_1_PI = 0.31830988618379067154
 Value of $\frac{1}{\pi}$.
static const double QG_1_SQRT_2PI = 0.39894228040143267794
 Value of $\frac{1}{\sqrt{2\pi}}$.
static const double QG_1_SQRT_PI = 0.56418958354775628695
 Value of $\frac{1}{\sqrt{\pi}}$.
static const double QG_2_PI = 0.63661977236758134308
 Value of $\frac{2}{\pi}$.
static const double QG_2_SQRT_PI = 1.12837916709551257390
 Value of $\frac{2}{\sqrt{\pi}}$ .
Constants related to sqrt(2)
static const double QG_SQRT_2 = 1.41421356237309504880
 Value of $\sqrt{2}$.
static const double QG_1_SQRT_2 = 0.70710678118654752440
 Value of $\frac{1}{\sqrt{2}}$.
Constants related to sqrt(3)
static const double QG_SQRT_3 = 1.73205080756887729353
 Value of $\sqrt{3}$.
static const double QG_1_SQRT_3 = 0.57735026918962576451
 Value of $\frac{1}{\sqrt{3}}$.
Constants for conversions
static const double QG_RADIANS_TO_DEGREES = 57.2957795130823208768
 Mutiplication factor to convert radians to degrees ($\frac{180}{\Pi}$ ).
static const double QG_DEGREES_TO_RADIANS = 0.01745329251994329577
 Mutiplication factor to convert degrees to radians ($\frac{\Pi}{180}$ ).
Constants related to limits
static const int QG_SQRT_MAX_INT16b = 46340
 Square root of the maximum positive integer coded on 16 bits (4 bytes: 0x7fffffff).

Private Member Functions

Constructors
 Math ()
 Disabled default constructor.

Static Private Attributes

Thresholds for (in)equality tests
static double _s_epsilon_double = 0.0001
 Threshold to test (in)equality between double numbers (default 1.e-4).
static float _s_epsilon_float = 0.0001f
 Threshold to test (in)equality between float numbers (default 1.e-4).
static int _s_epsilon_int = 1
 Threshold to test (in)equality between integer numbers (default 1).
static double _s_epsilon_radian = 0.005
 Threshold for testing (in)equality between angles in radians (default 0.005 radian $\approx$ 0.25 degree).
static double _s_epsilon_degree = 0.25
 Threshold for testing (in)equality between angles in degrees (default 0.25 degree).
Thresholds for numeric calculus
static double _s_rel_error_fp = 1.e-12
 Relative error for floating point numeric calculus (default 1.e-12).


Constructor & Destructor Documentation

qgar::Math::Math  )  [inline, private]
 

Disabled default constructor.

Warning:
The constructor belongs to the private section so that the class cannot be instantiated.

Definition at line 453 of file math.H.


Member Function Documentation

double qgar::Math::epsilonD  )  [inline, static]
 

Get threshold for equality tests between double numbers.

Definition at line 555 of file math.H.

References _s_epsilon_double.

double qgar::Math::epsilonDegree  )  [inline, static]
 

Get threshold for equality tests between angles in degrees.

Definition at line 591 of file math.H.

References _s_epsilon_degree.

float qgar::Math::epsilonF  )  [inline, static]
 

Get threshold for equality tests between float numbers.

Definition at line 564 of file math.H.

References _s_epsilon_float.

int qgar::Math::epsilonI  )  [inline, static]
 

Get threshold for equality tests between int numbers.

Definition at line 573 of file math.H.

References _s_epsilon_int.

double qgar::Math::epsilonRadian  )  [inline, static]
 

Get threshold for equality tests between angles in radians.

Definition at line 582 of file math.H.

References _s_epsilon_radian.

double qgar::Math::relError  )  [inline, static]
 

Get relative error for floating point numeric calculus.

Since:
Qgar 2.2

Definition at line 541 of file math.H.

References _s_rel_error_fp.

Referenced by qgar::qgErf(), and qgar::qgErfc().

void qgar::Math::setEpsilonD double  anEpsilon  )  [inline, static]
 

Set threshold for equality tests between double numbers.

Parameters:
anEpsilon new value of the threshold

Definition at line 619 of file math.H.

References _s_epsilon_double.

void qgar::Math::setEpsilonDegree double  anEpsilon  )  [inline, static]
 

Set threshold for equality tests between angles in degrees.

Parameters:
anEpsilon new value of the threshold

Definition at line 655 of file math.H.

References _s_epsilon_degree.

void qgar::Math::setEpsilonF float  anEpsilon  )  [inline, static]
 

Set threshold for equality test between float numbers.

Parameters:
anEpsilon new value of the threshold

Definition at line 628 of file math.H.

References _s_epsilon_float.

void qgar::Math::setEpsilonI int  anEpsilon  )  [inline, static]
 

Set threshold for equality tests between int numbers.

Parameters:
anEpsilon new value of the threshold

Definition at line 637 of file math.H.

References _s_epsilon_int.

void qgar::Math::setEpsilonRadian double  anEpsilon  )  [inline, static]
 

Set threshold for equality tests between angles in radians.

Parameters:
anEpsilon new value of the threshold

Definition at line 646 of file math.H.

References _s_epsilon_radian.

void qgar::Math::setRelError double  aRelError  )  [inline, static]
 

Set relative error for floating point numeric calculus.

Parameters:
aRelError new value of the relative error
Since:
Qgar 2.2

Definition at line 605 of file math.H.

References _s_rel_error_fp.


Member Data Documentation

double qgar::Math::_s_epsilon_degree = 0.25 [static, private]
 

Threshold for testing (in)equality between angles in degrees (default 0.25 degree).

Definition at line 263 of file math.C.

Referenced by epsilonDegree(), and setEpsilonDegree().

double qgar::Math::_s_epsilon_double = 0.0001 [static, private]
 

Threshold to test (in)equality between double numbers (default 1.e-4).

Definition at line 243 of file math.C.

Referenced by epsilonD(), and setEpsilonD().

float qgar::Math::_s_epsilon_float = 0.0001f [static, private]
 

Threshold to test (in)equality between float numbers (default 1.e-4).

Definition at line 248 of file math.C.

Referenced by epsilonF(), and setEpsilonF().

int qgar::Math::_s_epsilon_int = 1 [static, private]
 

Threshold to test (in)equality between integer numbers (default 1).

Definition at line 253 of file math.C.

Referenced by epsilonI(), and setEpsilonI().

double qgar::Math::_s_epsilon_radian = 0.005 [static, private]
 

Threshold for testing (in)equality between angles in radians (default 0.005 radian $\approx$ 0.25 degree).

Definition at line 258 of file math.C.

Referenced by epsilonRadian(), and setEpsilonRadian().

double qgar::Math::_s_rel_error_fp = 1.e-12 [static, private]
 

Relative error for floating point numeric calculus (default 1.e-12).

The default value corresponds to 12 significant figures. It can be adjusted to trade off between accuracy and speed: See functions qgar::Math::relError and qgar::Math::setRelError.

Warning:
Assuming a usual 52-bit mantissa in a double number, the lowest value of this threshold should be 1.e-15
Since:
Qgar 2.2

Definition at line 274 of file math.C.

Referenced by relError(), and setRelError().

const double qgar::Math::QG_1_2PI = 0.15915494309189533577 [static]
 

Value of $\frac{1}{2\pi}$.

Definition at line 154 of file math.C.

const double qgar::Math::QG_1_PI = 0.31830988618379067154 [static]
 

Value of $\frac{1}{\pi}$.

Definition at line 158 of file math.C.

const double qgar::Math::QG_1_SQRT_2 = 0.70710678118654752440 [static]
 

Value of $\frac{1}{\sqrt{2}}$.

Definition at line 191 of file math.C.

const double qgar::Math::QG_1_SQRT_2PI = 0.39894228040143267794 [static]
 

Value of $\frac{1}{\sqrt{2\pi}}$.

Definition at line 166 of file math.C.

Referenced by qgar::MASK1DGAUSSD1_phi1(), and qgar::MASK1DGAUSSD2_phi2().

const double qgar::Math::QG_1_SQRT_3 = 0.57735026918962576451 [static]
 

Value of $\frac{1}{\sqrt{3}}$.

Definition at line 207 of file math.C.

const double qgar::Math::QG_1_SQRT_PI = 0.56418958354775628695 [static]
 

Value of $\frac{1}{\sqrt{\pi}}$.

Definition at line 162 of file math.C.

Referenced by qgar::qgErfc().

const double qgar::Math::QG_2_PI = 0.63661977236758134308 [static]
 

Value of $\frac{2}{\pi}$.

Since:
Qgar 2.2

Definition at line 171 of file math.C.

const double qgar::Math::QG_2_SQRT_PI = 1.12837916709551257390 [static]
 

Value of $\frac{2}{\sqrt{\pi}}$ .

Since:
Qgar 2.2

Definition at line 175 of file math.C.

Referenced by qgar::qgErf().

const double qgar::Math::QG_2PI = 6.28318530717958647692 [static]
 

Value of $2\pi$.

Definition at line 140 of file math.C.

Referenced by qgar::GenArc< T >::angle(), qgar::Maer::PRIVATEcomputeMaer(), qgar::qgAngle(), and RWARCVECTOR_bestAttributes().

const double qgar::Math::QG_DEGREES_TO_RADIANS = 0.01745329251994329577 [static]
 

Mutiplication factor to convert degrees to radians ($\frac{\Pi}{180}$ ).

Since:
Qgar 2.2

Definition at line 223 of file math.C.

Referenced by qgar::qgDegreesToRadians().

const double qgar::Math::QG_DOUBLE_MAX = 1.79769313486231570e+308 [static]
 

Maximum double number.

Warning:
Only valid for IEEE-754 compliant architectures.

Definition at line 66 of file math.C.

const double qgar::Math::QG_DOUBLE_MIN = 4.94065645841246544e-324 [static]
 

Minimum double number.

Warning:
Only valid for IEEE-754 compliant architectures.

Definition at line 70 of file math.C.

const double qgar::Math::QG_E = 2.7182818284590452354 [static]
 

Value of $e$.

Since:
Qgar 2.2

Definition at line 91 of file math.C.

const float qgar::Math::QG_FLOAT_MAX = 3.40282346638528860e+38 [static]
 

Maximum float number.

Warning:
Only valid for IEEE-754 compliant architectures.

Definition at line 74 of file math.C.

const float qgar::Math::QG_FLOAT_MIN = 1.40129846432481707e-45 [static]
 

Minimum float number.

Warning:
Only valid for IEEE-754 compliant architectures.

Definition at line 78 of file math.C.

const double qgar::Math::QG_LN10 = 2.30258509299404568402 [static]
 

Value of $\ln{10}$.

Since:
Qgar 2.2

Definition at line 108 of file math.C.

const double qgar::Math::QG_LN2 = 0.69314718055994530942 [static]
 

Value of $\ln{2}$.

Since:
Qgar 2.2

Definition at line 104 of file math.C.

const double qgar::Math::QG_LOG10E = 0.43429448190325182765 [static]
 

Value of $\log_{10}{e}$.

Since:
Qgar 2.2

Definition at line 100 of file math.C.

const double qgar::Math::QG_LOG2E = 1.4426950408889634074 [static]
 

Value of $\log_2{e}$.

Since:
Qgar 2.2

Definition at line 96 of file math.C.

const double qgar::Math::QG_PI = 3.14159265358979323846 [static]
 

Value of $\pi$.

Definition at line 120 of file math.C.

Referenced by qgar::GenConvexHull< T >::PRIVATEgraham_sScan(), qgar::qgIntersect(), qgar::qgSlope(), and qgar::RWArcVector::RWArcVector().

const double qgar::Math::QG_PI_2 = 1.57079632679489661923 [static]
 

Value of $\frac{\pi}{2}$.

Definition at line 124 of file math.C.

Referenced by RWARCVECTOR_bestAttributes().

const double qgar::Math::QG_PI_3 = 1.04719755119659774615 [static]
 

Value of $\frac{\pi}{3}$.

Definition at line 128 of file math.C.

const double qgar::Math::QG_PI_4 = 0.78539816339744830962 [static]
 

Value of $\frac{\pi}{4}$.

Definition at line 132 of file math.C.

const double qgar::Math::QG_PI_6 = 0.52359877559829887308 [static]
 

Value of $\frac{\pi}{6}$.

Definition at line 136 of file math.C.

const double qgar::Math::QG_RADIANS_TO_DEGREES = 57.2957795130823208768 [static]
 

Mutiplication factor to convert radians to degrees ($\frac{180}{\Pi}$ ).

Since:
Qgar 2.2

Definition at line 219 of file math.C.

Referenced by qgar::qgRadiansToDegrees().

const double qgar::Math::QG_SQRT_2 = 1.41421356237309504880 [static]
 

Value of $\sqrt{2}$.

Definition at line 187 of file math.C.

Referenced by qgar::MASK1DGAUSS_phi0().

const double qgar::Math::QG_SQRT_2PI = 2.50662827463100050242 [static]
 

Value of $\sqrt{2\pi}$.

Definition at line 145 of file math.C.

const double qgar::Math::QG_SQRT_3 = 1.73205080756887729353 [static]
 

Value of $\sqrt{3}$.

Definition at line 203 of file math.C.

const int qgar::Math::QG_SQRT_MAX_INT16b = 46340 [static]
 

Square root of the maximum positive integer coded on 16 bits (4 bytes: 0x7fffffff).

Definition at line 233 of file math.C.

Referenced by qgar::WDSegmentList::PRIVATEperform().

const double qgar::Math::QG_SQRT_PI = 1.77245385090551602730 [static]
 

Value of $\sqrt{\pi}$.

Definition at line 149 of file math.C.


The documentation for this class was generated from the following files: