#include <qgarlib/math.H>
Constants are defined as static members of class qgar::Math. They include:
Constants of general interest, like values related to number
, which are public data members of class qgar::Math, and are therefore accessed using the scope resolution operator, for example:
Math::QG_2_SQRT_PI Math::QG_DOUBLE_MAX Math::QG_SQRT_1_2
Thresholds (or whatsoever) used by library QgarLib, in particular for arithmetic based on float and double numbers. Such a threshold can be accessed or modified using only dedicated static public function members.
Global functions include:
Comparison functions, to test approximate equality and inequality between numbers, using thresholds defined by class qgar::Math (see above).
Conversion functions, to convert angles from radians to degrees, and conversely.
Functions to get the module of int, float and double numbers.
Classes | |
| class | qgar::Math |
| Global constants and thresholds, implemented as static data members of the class. More... | |
Global functions to test approximate equality between numbers | |
| bool | qgar::qgEq0 (double aDouble, double anEpsilon=Math::epsilonD()) |
| Is a double number approximately equal to zero? | |
| bool | qgar::qgEq0 (float aFloat, float anEpsilon=Math::epsilonF()) |
| Is a float number approximately equal to zero? | |
| bool | qgar::qgEq0 (int anInt, int anEpsilon=Math::epsilonI()) |
| Is an integer number approximately equal to zero? | |
| bool | qgar::qgEq0Radian (double aRadian, double anEpsilon=Math::epsilonRadian()) |
| Is an angle in radians approximately equal to zero? | |
| bool | qgar::qgEq0Degree (double aDegree, double anEpsilon=Math::epsilonDegree()) |
| Is an angle in degrees approximately equal to zero? | |
| bool | qgar::qgEq (double aDouble1, double aDouble2, double anEpsilon=Math::epsilonD()) |
| Approximate equality between two double numbers. | |
| bool | qgar::qgEq (float aFloat1, float aFloat2, float anEpsilon=Math::epsilonF()) |
| Approximate equality between two float numbers. | |
| bool | qgar::qgEq (int anInt1, int anInt2, int anEpsilon=Math::epsilonI()) |
| Approximate equality between two integer numbers. | |
| bool | qgar::qgEqRadian (double aRadian1, double aRadian2, double anEpsilon=Math::epsilonRadian()) |
| Approximate equality between two angles in radians. | |
| bool | qgar::qgEqDegree (double aDegree1, double aDegree2, double anEpsilon=Math::epsilonDegree()) |
| Approximate equality between two angles in degrees. | |
Global functions to test approximate inequality between numbers | |
| bool | qgar::qgNotEq0 (double aDouble, double anEpsilon=Math::epsilonD()) |
| Is a double number approximately not equal to zero? | |
| bool | qgar::qgNotEq0 (float aFloat, float anEpsilon=Math::epsilonF()) |
| Is a float number approximately not equal to zero? | |
| bool | qgar::qgNotEq (int anInt, int anEpsilon=Math::epsilonI()) |
| Is an integer number approximately not equal to zero? | |
| bool | qgar::qgNotEq0Radian (double aRadian, double anEpsilon=Math::epsilonRadian()) |
| Is an angle in radians approximately not equal to zero? | |
| bool | qgar::qgNotEq0Degree (double aDegree, double anEpsilon=Math::epsilonDegree()) |
| Is an angle in degrees approximately not equal to zero? | |
| bool | qgar::qgNotEq (double aDouble1, double aDouble2, double anEpsilon=Math::epsilonD()) |
| Approximate inequality between two double numbers. | |
| bool | qgar::qgNotEq (float aFloat1, float aFloat2, float anEpsilon=Math::epsilonF()) |
| Approximate inequality between two float numbers. | |
| bool | qgar::qgNotEq (int anInt1, int anInt2, int anEpsilon=Math::epsilonI()) |
| Approximate inequality between two integer numbers. | |
| bool | qgar::qgNotEqRadian (double aRadian1, double aRadian2, double anEpsilon=Math::epsilonRadian()) |
| Approximate inequality between two angles in radians. | |
| bool | qgar::qgNotEqDegree (double aDegree1, double aDegree2, double anEpsilon=Math::epsilonDegree()) |
| Approximate inequality between two angles in degrees. | |
Global functions for conversion in radians and degrees | |
| double | qgar::qgRadiansToDegrees (double aRadians) |
| Convert from radians to degrees. | |
| double | qgar::qgDegreesToRadians (double aDegrees) |
| Convert from degrees to radians. | |
Global error functions | |
| double | qgar::qgErf (double x) |
| Compute the error function of the argument. | |
| double | qgar::qgErfc (double x) |
| Compute the complementary error function of the argument. | |
Global functions to compute the module of a number | |
| template<class T> | |
| T | qgar::qgAbs (T aVal) |
| Module of given value (any type). | |
| template<> | |
| int | qgar::qgAbs< int > (int aNb) |
| Module of an int number. | |
| template<> | |
| float | qgar::qgAbs< float > (float aNb) |
| Module of a float number. | |
| template<> | |
| double | qgar::qgAbs< double > (double aNb) |
| Module of a double number. | |
|
||||||||||
|
Module of given value (any type).
Definition at line 1185 of file math.H. Referenced by qgar::GenSegment< T >::rho(). |
|
||||||||||
|
Module of a double number.
|
|
||||||||||
|
Module of a float number.
|
|
||||||||||
|
Module of an int number.
|
|
|
Convert from degrees to radians.
Definition at line 1075 of file math.H. References qgar::Math::QG_DEGREES_TO_RADIANS. Referenced by qgar::DxfFile::retrievePQgarArc(). |
|
||||||||||||||||
|
Approximate equality between two integer numbers.
Definition at line 817 of file math.H. References qgar::qgEq0(). |
|
||||||||||||||||
|
Approximate equality between two float numbers.
Definition at line 798 of file math.H. References qgar::qgEq0(). |
|
||||||||||||||||
|
Approximate equality between two double numbers.
Definition at line 779 of file math.H. References qgar::qgEq0(). Referenced by qgar::qgIntersect(), qgar::qgNotEq(), qgar::qgNotEqDegree(), and qgar::qgNotEqRadian(). |
|
||||||||||||
|
Is an integer number approximately equal to zero?
|
|
||||||||||||
|
Is a float number approximately equal to zero?
|
|
||||||||||||
|
Is a double number approximately equal to zero?
Definition at line 697 of file math.H. Referenced by qgar::GenKMeans< T >::PRIVATEinitCenters(), qgar::qgCircleCenter(), qgar::qgEq(), qgar::qgEq0Degree(), qgar::qgEq0Radian(), qgar::qgEqDegree(), qgar::qgEqRadian(), qgar::qgNotEq(), qgar::qgNotEq0(), qgar::qgNotEq0Degree(), and qgar::qgNotEq0Radian(). |
|
||||||||||||
|
Is an angle in degrees approximately equal to zero?
Definition at line 762 of file math.H. References qgar::qgEq0(). |
|
||||||||||||
|
Is an angle in radians approximately equal to zero?
Definition at line 745 of file math.H. References qgar::qgEq0(). |
|
||||||||||||||||
|
Approximate equality between two angles in degrees.
Definition at line 853 of file math.H. References qgar::qgEq0(). |
|
||||||||||||||||
|
Approximate equality between two angles in radians.
Definition at line 834 of file math.H. References qgar::qgEq0(). |
|
|
Compute the error function of the argument. Same as C function erf(x) (from <cmath>), which is not yet included in the ISO C standard. The relative error between the results provided by this function and C function erf(x) is guaranteed to be less than 1.e-11, using the standard precision rate given by function qgar::Math::relError. This precision rate may be changed using function qgar::Math::setRelError. Note that, assuming a usual 52-bit mantissa in a double number, the lowest rate should be 1.e-15
For
Definition at line 307 of file math.C. References qgar::Math::QG_2_SQRT_PI, qgar::qgErfc(), and qgar::Math::relError(). Referenced by qgar::qgErfc(). |
|
|
Compute the complementary error function of the argument. Same as C function erfc(x) (from <cmath>), which is not yet included in the ISO C standard. The relative error between the results provided by this function and C function erfc(x) is guaranteed to be less than 1.e-11, using the standard precision rate given by function qgar::Math::relError. This precision rate may be changed using function qgar::Math::setRelError. Note that, assuming a usual 52-bit mantissa in a double number, the lowest rate should be 1.e-15
For
Definition at line 351 of file math.C. References qgar::Math::QG_1_SQRT_PI, qgar::qgErf(), and qgar::Math::relError(). Referenced by qgar::MASK1DGAUSS_phi0(), and qgar::qgErf(). |
|
||||||||||||||||
|
Approximate inequality between two integer numbers.
Definition at line 998 of file math.H. References qgar::qgEq(). |
|
||||||||||||||||
|
Approximate inequality between two float numbers.
Definition at line 979 of file math.H. References qgar::qgEq(). |
|
||||||||||||||||
|
Approximate inequality between two double numbers.
Definition at line 960 of file math.H. References qgar::qgEq(). |
|
||||||||||||
|
Is an integer number approximately not equal to zero?
Definition at line 909 of file math.H. References qgar::qgEq0(). |
|
||||||||||||
|
Is a float number approximately not equal to zero?
Definition at line 893 of file math.H. References qgar::qgEq0(). |
|
||||||||||||
|
Is a double number approximately not equal to zero?
Definition at line 877 of file math.H. References qgar::qgEq0(). |
|
||||||||||||
|
Is an angle in degrees approximately not equal to zero?
Definition at line 942 of file math.H. References qgar::qgEq0(). |
|
||||||||||||
|
Is an angle in radians approximately not equal to zero?
Definition at line 925 of file math.H. References qgar::qgEq0(). |
|
||||||||||||||||
|
Approximate inequality between two angles in degrees.
Definition at line 1035 of file math.H. References qgar::qgEq(). |
|
||||||||||||||||
|
Approximate inequality between two angles in radians.
Definition at line 1016 of file math.H. References qgar::qgEq(). |
|
|
Convert from radians to degrees.
Definition at line 1062 of file math.H. References qgar::Math::QG_RADIANS_TO_DEGREES. Referenced by qgar::GenSegment< T >::angleDegrees(), qgar::GenArc< T >::angleDegrees(), qgar::qgAngleDegrees(), qgar::qgSlopeDegrees(), qgar::GenSegment< T >::slopeDegrees(), qgar::GenArc< T >::sourceAngleDegrees(), qgar::GenArc< T >::targetAngleDegrees(), and qgar::GenSegment< T >::thetaDegrees(). |