better flag name and docs
							parent
							
								
									50643becce
								
							
						
					
					
						commit
						0737a4594a
					
				| 
						 | 
					@ -39,7 +39,7 @@ namespace gtsam {
 | 
				
			||||||
 * 1. https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
 | 
					 * 1. https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
 | 
				
			||||||
 * 2. https://floating-point-gui.de/errors/comparison/
 | 
					 * 2. https://floating-point-gui.de/errors/comparison/
 | 
				
			||||||
 * ************************************************************************* */
 | 
					 * ************************************************************************* */
 | 
				
			||||||
bool fpEqual(double a, double b, double tol, bool check_relative) {
 | 
					bool fpEqual(double a, double b, double tol, bool check_relative_also) {
 | 
				
			||||||
  using std::abs;
 | 
					  using std::abs;
 | 
				
			||||||
  using std::isnan;
 | 
					  using std::isnan;
 | 
				
			||||||
  using std::isinf;
 | 
					  using std::isinf;
 | 
				
			||||||
| 
						 | 
					@ -68,7 +68,7 @@ bool fpEqual(double a, double b, double tol, bool check_relative) {
 | 
				
			||||||
  // Check for relative error
 | 
					  // Check for relative error
 | 
				
			||||||
  else if (abs(a - b) <=
 | 
					  else if (abs(a - b) <=
 | 
				
			||||||
               tol * min(larger, std::numeric_limits<double>::max()) &&
 | 
					               tol * min(larger, std::numeric_limits<double>::max()) &&
 | 
				
			||||||
           check_relative) {
 | 
					           check_relative_also) {
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,13 +85,15 @@ static_assert(
 | 
				
			||||||
 * respectively for the comparison to be true.
 | 
					 * respectively for the comparison to be true.
 | 
				
			||||||
 * If one is NaN/Inf and the other is not, returns false.
 | 
					 * If one is NaN/Inf and the other is not, returns false.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * The `check_relative` flag toggles checking for relative error as well. By
 | 
					 * @param check_relative_also is a flag which toggles additional checking for
 | 
				
			||||||
 * default, the flag is true.
 | 
					 * relative error. This means that if either the absolute error or the relative
 | 
				
			||||||
 | 
					 * error is within the tolerance, the result will be true.
 | 
				
			||||||
 | 
					 * By default, the flag is true.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Return true if two numbers are close wrt tol.
 | 
					 * Return true if two numbers are close wrt tol.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
GTSAM_EXPORT bool fpEqual(double a, double b, double tol,
 | 
					GTSAM_EXPORT bool fpEqual(double a, double b, double tol,
 | 
				
			||||||
                          bool check_relative = true);
 | 
					                          bool check_relative_also = true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * print without optional string, must specify cout yourself
 | 
					 * print without optional string, must specify cout yourself
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue