Method AreClose
AreClose(double, double)
Determines whether two double values are equal using a layered comparison strategy. This method combines magnitude-scaled epsilon comparison, bitwise proximity (with default step threshold), and relative/absolute tolerance checks. It is suitable for robust floating-point validation across domains such as diagnostics, serialization, and numerical correctness.
public static bool AreClose(double a, double b)
Parameters
Returns
- bool
trueif any of the following conditions are met:- AreCloseScaled(double, double) returns true
- AreCloseBitwise(double, double) returns true using its default threshold
- AreCloseWithTolerance(double, double) returns true
false.
AreClose(float, float)
Determines whether two float values are equal using a layered comparison strategy. This method combines magnitude-scaled epsilon comparison, bitwise proximity (with default step threshold), and relative/absolute tolerance checks. It is suitable for robust floating-point validation across domains such as diagnostics, serialization, and numerical correctness.
public static bool AreClose(float a, float b)
Parameters
Returns
- bool
trueif any of the following conditions are met:- AreCloseScaled(float, float) returns true
- AreCloseBitwise(float, float) returns true using its default threshold
- AreCloseWithTolerance(float, float) returns true
false.