|
crypto_trader
Cryptocurrency Trading Bot API Documentation
|
Provides static utility methods for safe floating-point comparisons. More...
#include <math.h>

Static Public Member Functions | |
| static bool | isEqual (double a, double b, double relEpsilon=DEFAULT_REL_EPSILON, double absEpsilon=DEFAULT_ABS_EPSILON) |
| Checks if two double-precision floating-point numbers are considered equal within a specified relative and/or absolute tolerance. | |
| static bool | isNotEqual (double a, double b, double relEpsilon=DEFAULT_REL_EPSILON, double absEpsilon=DEFAULT_ABS_EPSILON) |
| Checks if two double-precision floating-point numbers are considered not equal. | |
| static bool | isLess (double a, double b, double relEpsilon=DEFAULT_REL_EPSILON, double absEpsilon=DEFAULT_ABS_EPSILON) |
| Checks if the first double value is strictly less than the second, considering floating-point tolerance. | |
| static bool | isGreater (double a, double b, double relEpsilon=DEFAULT_REL_EPSILON, double absEpsilon=DEFAULT_ABS_EPSILON) |
| Checks if the first double value is strictly greater than the second, considering floating-point tolerance. | |
| static bool | isLessOrEqual (double a, double b, double relEpsilon=DEFAULT_REL_EPSILON, double absEpsilon=DEFAULT_ABS_EPSILON) |
| Checks if the first double value is less than or equal to the second, considering floating-point tolerance. | |
| static bool | isGreaterOrEqual (double a, double b, double relEpsilon=DEFAULT_REL_EPSILON, double absEpsilon=DEFAULT_ABS_EPSILON) |
| Checks if the first double value is greater than or equal to the second, considering floating-point tolerance. | |
| static bool | isZero (double a, double absEpsilon=DEFAULT_ABS_EPSILON) |
| Checks if a double value is effectively zero within an absolute tolerance. | |
Static Public Attributes | |
| static constexpr double | DEFAULT_REL_EPSILON = 1e-9 |
| Default relative epsilon for comparisons. | |
| static constexpr double | DEFAULT_ABS_EPSILON = 1e-12 |
| Default absolute epsilon for comparisons near zero. | |
Provides static utility methods for safe floating-point comparisons.
This class implements a hybrid comparison approach (relative and absolute epsilon) to account for the inherent imprecision of floating-point numbers across different scales.
|
inlinestatic |
Checks if two double-precision floating-point numbers are considered equal within a specified relative and/or absolute tolerance.
| a | The first double value. |
| b | The second double value. |
| relEpsilon | The relative epsilon value. Defaults to DEFAULT_REL_EPSILON. |
| absEpsilon | The absolute epsilon value. Defaults to DEFAULT_ABS_EPSILON. |
|
inlinestatic |
Checks if the first double value is strictly greater than the second, considering floating-point tolerance.
| a | The first double value. |
| b | The second double value. |
| relEpsilon | The relative epsilon value. Defaults to DEFAULT_REL_EPSILON. |
| absEpsilon | The absolute epsilon value. Defaults to DEFAULT_ABS_EPSILON. |
|
inlinestatic |
Checks if the first double value is greater than or equal to the second, considering floating-point tolerance.
| a | The first double value. |
| b | The second double value. |
| relEpsilon | The relative epsilon value. Defaults to DEFAULT_REL_EPSILON. |
| absEpsilon | The absolute epsilon value. Defaults to DEFAULT_ABS_EPSILON. |
|
inlinestatic |
Checks if the first double value is strictly less than the second, considering floating-point tolerance.
| a | The first double value. |
| b | The second double value. |
| relEpsilon | The relative epsilon value. Defaults to DEFAULT_REL_EPSILON. |
| absEpsilon | The absolute epsilon value. Defaults to DEFAULT_ABS_EPSILON. |
|
inlinestatic |
Checks if the first double value is less than or equal to the second, considering floating-point tolerance.
| a | The first double value. |
| b | The second double value. |
| relEpsilon | The relative epsilon value. Defaults to DEFAULT_REL_EPSILON. |
| absEpsilon | The absolute epsilon value. Defaults to DEFAULT_ABS_EPSILON. |
|
inlinestatic |
Checks if two double-precision floating-point numbers are considered not equal.
| a | The first double value. |
| b | The second double value. |
| relEpsilon | The relative epsilon value. Defaults to DEFAULT_REL_EPSILON. |
| absEpsilon | The absolute epsilon value. Defaults to DEFAULT_ABS_EPSILON. |
|
inlinestatic |
Checks if a double value is effectively zero within an absolute tolerance.
| a | The double value to check. |
| absEpsilon | The absolute epsilon value. Defaults to DEFAULT_ABS_EPSILON. |
|
staticconstexpr |
Default absolute epsilon for comparisons near zero.
|
staticconstexpr |
Default relative epsilon for comparisons.