This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new e747af65e1 MINOR: [C++] Make argument name consistent (#44973)
e747af65e1 is described below

commit e747af65e1c217371a355ea3117e7b16a36afb2d
Author: Antoine Pitrou <[email protected]>
AuthorDate: Mon Dec 9 14:45:04 2024 +0100

    MINOR: [C++] Make argument name consistent (#44973)
    
    Followup to https://github.com/apache/arrow/pull/44955
    
    Authored-by: Antoine Pitrou <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 cpp/src/arrow/testing/math.cc | 26 +++++++++++++-------------
 cpp/src/arrow/testing/math.h  |  4 ++--
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/cpp/src/arrow/testing/math.cc b/cpp/src/arrow/testing/math.cc
index c3246b1221..2cb2fcb2a9 100644
--- a/cpp/src/arrow/testing/math.cc
+++ b/cpp/src/arrow/testing/math.cc
@@ -28,12 +28,12 @@ namespace arrow {
 namespace {
 
 template <typename Float>
-bool WithinUlpOneWay(Float left, Float right, int n_ulp) {
+bool WithinUlpOneWay(Float left, Float right, int n_ulps) {
   // The delta between 1.0 and the FP value immediately before it.
   // We're using this value because `frexp` returns a mantissa between 0.5 and 
1.0.
   static const Float kOneUlp = Float(1.0) - std::nextafter(Float(1.0), 
Float(0.0));
 
-  DCHECK_GE(n_ulp, 1);
+  DCHECK_GE(n_ulps, 1);
 
   if (left == 0) {
     return left == right;
@@ -45,36 +45,36 @@ bool WithinUlpOneWay(Float left, Float right, int n_ulp) {
 
   int left_exp;
   Float left_mant = std::frexp(left, &left_exp);
-  Float delta = static_cast<Float>(n_ulp) * kOneUlp;
+  Float delta = static_cast<Float>(n_ulps) * kOneUlp;
   Float lower_bound = std::ldexp(left_mant - delta, left_exp);
   Float upper_bound = std::ldexp(left_mant + delta, left_exp);
   return right >= lower_bound && right <= upper_bound;
 }
 
 template <typename Float>
-bool WithinUlpGeneric(Float left, Float right, int n_ulp) {
+bool WithinUlpGeneric(Float left, Float right, int n_ulps) {
   if (!std::isfinite(left) || !std::isfinite(right)) {
     return left == right;
   }
-  return (std::abs(left) <= std::abs(right)) ? WithinUlpOneWay(left, right, 
n_ulp)
-                                             : WithinUlpOneWay(right, left, 
n_ulp);
+  return (std::abs(left) <= std::abs(right)) ? WithinUlpOneWay(left, right, 
n_ulps)
+                                             : WithinUlpOneWay(right, left, 
n_ulps);
 }
 
 template <typename Float>
-void AssertWithinUlpGeneric(Float left, Float right, int n_ulp) {
-  if (!WithinUlpGeneric(left, right, n_ulp)) {
-    FAIL() << left << " and " << right << " are not within " << n_ulp << " 
ulps";
+void AssertWithinUlpGeneric(Float left, Float right, int n_ulps) {
+  if (!WithinUlpGeneric(left, right, n_ulps)) {
+    FAIL() << left << " and " << right << " are not within " << n_ulps << " 
ulps";
   }
 }
 
 }  // namespace
 
-bool WithinUlp(float left, float right, int n_ulp) {
-  return WithinUlpGeneric(left, right, n_ulp);
+bool WithinUlp(float left, float right, int n_ulps) {
+  return WithinUlpGeneric(left, right, n_ulps);
 }
 
-bool WithinUlp(double left, double right, int n_ulp) {
-  return WithinUlpGeneric(left, right, n_ulp);
+bool WithinUlp(double left, double right, int n_ulps) {
+  return WithinUlpGeneric(left, right, n_ulps);
 }
 
 void AssertWithinUlp(float left, float right, int n_ulps) {
diff --git a/cpp/src/arrow/testing/math.h b/cpp/src/arrow/testing/math.h
index 19001ac177..6aa3eac850 100644
--- a/cpp/src/arrow/testing/math.h
+++ b/cpp/src/arrow/testing/math.h
@@ -22,9 +22,9 @@
 namespace arrow {
 
 ARROW_TESTING_EXPORT
-bool WithinUlp(float left, float right, int n_ulp);
+bool WithinUlp(float left, float right, int n_ulps);
 ARROW_TESTING_EXPORT
-bool WithinUlp(double left, double right, int n_ulp);
+bool WithinUlp(double left, double right, int n_ulps);
 
 ARROW_TESTING_EXPORT
 void AssertWithinUlp(float left, float right, int n_ulps);

Reply via email to