added documentation to fpEqual on behavior for NaNs/Infs

release/4.3a0
Varun Agrawal 2020-03-13 19:42:14 -04:00
parent 0a91c081fb
commit b5e975f7e4
1 changed files with 7 additions and 2 deletions

View File

@ -80,9 +80,14 @@ static_assert(
* Numerically stable function for comparing if floating point values are equal * Numerically stable function for comparing if floating point values are equal
* within epsilon tolerance. * within epsilon tolerance.
* Used for vector and matrix comparison with C++11 compatible functions. * Used for vector and matrix comparison with C++11 compatible functions.
* Return true if two numbers are close wrt epsilon. *
* If either value is NaN or Inf, we check for both values to be NaN or Inf
* respectively for the comparison to be true.
* If one is NaN/Inf and the other is not, returns false.
*
* Return true if two numbers are close wrt tol.
*/ */
GTSAM_EXPORT bool fpEqual(double a, double b, double epsilon); GTSAM_EXPORT bool fpEqual(double a, double b, double tol);
/** /**
* print without optional string, must specify cout yourself * print without optional string, must specify cout yourself