andishgar commented on code in PR #49290:
URL: https://github.com/apache/arrow/pull/49290#discussion_r2854321150
##########
cpp/src/arrow/compare.h:
##########
@@ -66,6 +67,8 @@ class EqualOptions {
bool use_atol() const { return use_atol_; }
/// Return a new EqualOptions object with the "use_atol" property changed.
+ /// If both "ulp_distance" and "atol" are specified, the comparison
+ /// succeeds when either condition is satisfied.
Review Comment:
According to this
[link](https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/),
it seems to be a common approach to enable both methods and return true when
either of them is true.
_Doing a floating-point absolute epsilon check first, and then treating all
other different-signed numbers as being non-equal is the simpler and safer
thing to do. Here is some possible code for doing this, both for relative
epsilon and for ULPs based comparison, with an absolute epsilon ‘safety net’ to
handle the near-zero case:_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]