@@ -28,12 +28,12 @@ namespace arrow {
2828namespace  {
2929
3030template  <typename  Float>
31- bool  WithinUlpOneWay (Float left, Float right, int  n_ulp ) {
31+ bool  WithinUlpOneWay (Float left, Float right, int  n_ulps ) {
3232  //  The delta between 1.0 and the FP value immediately before it.
3333  //  We're using this value because `frexp` returns a mantissa between 0.5 and 1.0.
3434  static  const  Float kOneUlp  = Float (1.0 ) - std::nextafter (Float (1.0 ), Float (0.0 ));
3535
36-   DCHECK_GE (n_ulp , 1 );
36+   DCHECK_GE (n_ulps , 1 );
3737
3838  if  (left == 0 ) {
3939    return  left == right;
@@ -45,36 +45,36 @@ bool WithinUlpOneWay(Float left, Float right, int n_ulp) {
4545
4646  int  left_exp;
4747  Float left_mant = std::frexp (left, &left_exp);
48-   Float delta = static_cast <Float>(n_ulp ) * kOneUlp ;
48+   Float delta = static_cast <Float>(n_ulps ) * kOneUlp ;
4949  Float lower_bound = std::ldexp (left_mant - delta, left_exp);
5050  Float upper_bound = std::ldexp (left_mant + delta, left_exp);
5151  return  right >= lower_bound && right <= upper_bound;
5252}
5353
5454template  <typename  Float>
55- bool  WithinUlpGeneric (Float left, Float right, int  n_ulp ) {
55+ bool  WithinUlpGeneric (Float left, Float right, int  n_ulps ) {
5656  if  (!std::isfinite (left) || !std::isfinite (right)) {
5757    return  left == right;
5858  }
59-   return  (std::abs (left) <= std::abs (right)) ? WithinUlpOneWay (left, right, n_ulp )
60-                                              : WithinUlpOneWay (right, left, n_ulp );
59+   return  (std::abs (left) <= std::abs (right)) ? WithinUlpOneWay (left, right, n_ulps )
60+                                              : WithinUlpOneWay (right, left, n_ulps );
6161}
6262
6363template  <typename  Float>
64- void  AssertWithinUlpGeneric (Float left, Float right, int  n_ulp ) {
65-   if  (!WithinUlpGeneric (left, right, n_ulp )) {
66-     FAIL () << left << "  and " "  are not within " n_ulp  << "  ulps" 
64+ void  AssertWithinUlpGeneric (Float left, Float right, int  n_ulps ) {
65+   if  (!WithinUlpGeneric (left, right, n_ulps )) {
66+     FAIL () << left << "  and " "  are not within " n_ulps  << "  ulps" 
6767  }
6868}
6969
7070}  //  namespace
7171
72- bool  WithinUlp (float  left, float  right, int  n_ulp ) {
73-   return  WithinUlpGeneric (left, right, n_ulp );
72+ bool  WithinUlp (float  left, float  right, int  n_ulps ) {
73+   return  WithinUlpGeneric (left, right, n_ulps );
7474}
7575
76- bool  WithinUlp (double  left, double  right, int  n_ulp ) {
77-   return  WithinUlpGeneric (left, right, n_ulp );
76+ bool  WithinUlp (double  left, double  right, int  n_ulps ) {
77+   return  WithinUlpGeneric (left, right, n_ulps );
7878}
7979
8080void  AssertWithinUlp (float  left, float  right, int  n_ulps) {
0 commit comments