hydrobricks
Loading...
Searching...
No Matches
NumericConstants.h File Reference

Centralized numeric tolerance policy and comparison utilities. More...

#include <cmath>
#include <limits>

Go to the source code of this file.

Functions

bool NumericConstants::NearlyEqual (double a, double b, double tolerance=PRECISION)
 
bool NumericConstants::NearlyZero (double value, double tolerance=PRECISION)
 
bool NumericConstants::GreaterThan (double a, double b, double tolerance=PRECISION)
 
bool NumericConstants::LessThan (double a, double b, double tolerance=PRECISION)
 
bool NumericConstants::GreaterThanOrEqual (double a, double b, double tolerance=PRECISION)
 
bool NumericConstants::LessThanOrEqual (double a, double b, double tolerance=PRECISION)
 

Detailed Description

Centralized numeric tolerance policy and comparison utilities.

This file provides consistent tolerance values and helper functions for floating-point comparisons throughout the codebase.

Function Documentation

◆ GreaterThan()

bool NumericConstants::GreaterThan ( double a,
double b,
double tolerance = PRECISION )
inline

Check if value a is greater than value b with tolerance.

Parameters
aFirst value
bSecond value
toleranceTolerance threshold for comparison (default: PRECISION)
Returns
true if a > b + tolerance, false otherwise

◆ GreaterThanOrEqual()

bool NumericConstants::GreaterThanOrEqual ( double a,
double b,
double tolerance = PRECISION )
inline

Check if value a is greater than or equal to value b with tolerance.

Parameters
aFirst value
bSecond value
toleranceTolerance threshold for comparison (default: PRECISION)
Returns
true if a >= b - tolerance, false otherwise

◆ LessThan()

bool NumericConstants::LessThan ( double a,
double b,
double tolerance = PRECISION )
inline

Check if value a is less than value b with tolerance.

Parameters
aFirst value
bSecond value
toleranceTolerance threshold for comparison (default: PRECISION)
Returns
true if a < b - tolerance, false otherwise

◆ LessThanOrEqual()

bool NumericConstants::LessThanOrEqual ( double a,
double b,
double tolerance = PRECISION )
inline

Check if value a is less than or equal to value b with tolerance.

Parameters
aFirst value
bSecond value
toleranceTolerance threshold for comparison (default: PRECISION)
Returns
true if a <= b + tolerance, false otherwise

◆ NearlyEqual()

bool NumericConstants::NearlyEqual ( double a,
double b,
double tolerance = PRECISION )
inline

Compare two floating-point values for near-equality.

Parameters
aFirst value to compare
bSecond value to compare
toleranceTolerance threshold for comparison (default: PRECISION)
Returns
true if |a - b| <= tolerance, false otherwise

◆ NearlyZero()

bool NumericConstants::NearlyZero ( double value,
double tolerance = PRECISION )
inline

Check if a value is nearly zero.

Parameters
valueValue to check
toleranceTolerance threshold for comparison (default: PRECISION)
Returns
true if |value| <= tolerance, false otherwise