|
Chaste Release::3.1
|
#include <MathsCustomFunctions.hpp>
Static Public Member Functions | |
| static bool | IsNearZero (double number, double tolerance) |
| static bool | WithinRelativeTolerance (double number1, double number2, double tolerance) |
| static bool | WithinAbsoluteTolerance (double number1, double number2, double tolerance) |
| static bool | WithinTolerance (double number1, double number2, double tolerance, bool toleranceIsAbsolute) |
| static bool | WithinAnyTolerance (double number1, double number2, double relTol=DBL_EPSILON, double absTol=DBL_EPSILON, bool printError=false) |
| static double | Difference (double number1, double number2, bool toleranceIsAbsolute) |
Utility static methods for comparing floating point numbers, based on boost/test/floating_point_comparison.hpp.
Definition at line 70 of file MathsCustomFunctions.hpp.
| double CompareDoubles::Difference | ( | double | number1, |
| double | number2, | ||
| bool | toleranceIsAbsolute | ||
| ) | [static] |
Compute the relative or absolute difference between two numbers.
| number1 | the first number to compare |
| number2 | the second number to compare |
| toleranceIsAbsolute | whether the tolerance is absolute (true) or relative (false) |
Definition at line 175 of file MathsCustomFunctions.cpp.
Test whether a number is close to zero, as defined by the given tolerance. A number equal in magnitude to the tolerance is OK.
| number | the number to compare |
| tolerance | how close it must be |
Definition at line 101 of file MathsCustomFunctions.cpp.
| bool CompareDoubles::WithinAbsoluteTolerance | ( | double | number1, |
| double | number2, | ||
| double | tolerance | ||
| ) | [static] |
Test whether two numbers are close within the given absolute tolerance. A difference of exactly the tolerance is OK.
| number1 | the first number to compare |
| number2 | the second number to compare |
| tolerance | the absolute tolerance to use |
Definition at line 138 of file MathsCustomFunctions.cpp.
Referenced by WithinAnyTolerance(), and WithinTolerance().
| bool CompareDoubles::WithinAnyTolerance | ( | double | number1, |
| double | number2, | ||
| double | relTol = DBL_EPSILON, |
||
| double | absTol = DBL_EPSILON, |
||
| bool | printError = false |
||
| ) | [static] |
Test whether two numbers are close within the given tolerances. If either the relative or absolute tolerance is satisfied, then the result is true.
| number1 | the first number to compare |
| number2 | the second number to compare |
| relTol | the relative tolerance to compare under |
| absTol | the absolute tolerance to compare under |
| printError | whether to print an error message to stdout |
Definition at line 143 of file MathsCustomFunctions.cpp.
References WithinAbsoluteTolerance(), and WithinRelativeTolerance().
Referenced by NumericFileComparison::CompareFiles(), CvodeAdaptor::SetupCvode(), and AbstractCvodeSystem::SetupCvode().
| bool CompareDoubles::WithinRelativeTolerance | ( | double | number1, |
| double | number2, | ||
| double | tolerance | ||
| ) | [static] |
Test whether two numbers are close within the given relative tolerance.
| number1 | the first number to compare |
| number2 | the second number to compare |
| tolerance | the relative tolerance to use |
Definition at line 129 of file MathsCustomFunctions.cpp.
Referenced by WithinAnyTolerance(), and WithinTolerance().
| bool CompareDoubles::WithinTolerance | ( | double | number1, |
| double | number2, | ||
| double | tolerance, | ||
| bool | toleranceIsAbsolute | ||
| ) | [static] |
Test whether two numbers are close within the given tolerance, and print an error message to stdout if not.
| number1 | the first number to compare |
| number2 | the second number to compare |
| tolerance | the tolerance to use |
| toleranceIsAbsolute | whether the tolerance is absolute (true) or relative (false) |
Definition at line 155 of file MathsCustomFunctions.cpp.
References WithinAbsoluteTolerance(), and WithinRelativeTolerance().