Skip to content

Commit fab8ec2

Browse files
author
Jon-Patrick Cook
committed
Fixed math_isclose_impl return per PEP 7 - C Style
1 parent 1777daa commit fab8ec2

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

Modules/mathmodule.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Math module -- standard C math library functions, pi and e */
22

3-
/*
3+
/*
44
Here are some comments from Tim Peters, extracted from the
55
discussion attached to http://bugs.python.org/issue1640. They
66
describe the general aims of the math module with respect to
@@ -192,7 +192,7 @@ tl_to_d(TripleLength total)
192192
static const double pi = 3.141592653589793238462643383279502884197;
193193
static const double logpi = 1.144729885849400174143427351353058711647;
194194

195-
/*
195+
/*
196196
Version of PyFloat_AsDouble() with in-line fast paths
197197
for exact floats and integers. Gives a substantial
198198
speed improvement for extracting float arguments.
@@ -249,7 +249,7 @@ m_sinpi(double x)
249249
return copysign(1.0, x)*r;
250250
}
251251

252-
/*
252+
/*
253253
Implementation of the real gamma function. Kept here to work around
254254
issues (see e.g. gh-70309) with quality of libm's tgamma/lgamma implementations
255255
on various platforms (Windows, MacOS). In extensive but non-exhaustive
@@ -834,7 +834,7 @@ math_lcm_impl(PyObject *module, PyObject * const *args,
834834
return res;
835835
}
836836

837-
/*
837+
/*
838838
Call is_error when errno != 0, and where x is the result libm
839839
returned. is_error will usually set up an exception and return
840840
true (1), but may return false (0) without setting up an exception.
@@ -945,14 +945,14 @@ math_1(PyObject *arg, double (*func) (double), int can_overflow,
945945
PyErr_Format(PyExc_ValueError, err_msg, buf);
946946
PyMem_Free(buf);
947947
}
948-
}
949-
else {
950-
PyErr_SetString(PyExc_ValueError, "math domain error");
951-
}
948+
}
949+
else {
950+
PyErr_SetString(PyExc_ValueError, "math domain error");
951+
}
952952
return NULL;
953953
}
954954

955-
/*
955+
/*
956956
Variant of math_1, to be used when the function being wrapped is known to
957957
set errno properly (that is, errno = EDOM for invalid or divide-by-zero,
958958
errno = ERANGE for overflow).
@@ -1300,7 +1300,7 @@ FUNC1(tanh, tanh, 0,
13001300
"tanh($module, x, /)\n--\n\n"
13011301
"Return the hyperbolic tangent of x.")
13021302

1303-
/*
1303+
/*
13041304
Precision summation function as msum() by Raymond Hettinger in
13051305
<https://code.activestate.com/recipes/393090-binary-floating-point-summation-accurate-to-full-p/>,
13061306
enhanced with the exact partials sum and roundoff from Mark
@@ -1714,7 +1714,7 @@ static const uint8_t _approximate_isqrt_tab[192] = {
17141714
250, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, 255,
17151715
};
17161716

1717-
/*
1717+
/*
17181718
Approximate square root of a large 64-bit integer.
17191719
17201720
Given `n` satisfying `2**62 <= n < 2**64`, return `a`
@@ -1865,7 +1865,7 @@ math_isqrt(PyObject *module, PyObject *n)
18651865
return NULL;
18661866
}
18671867

1868-
/*
1868+
/*
18691869
Divide-and-conquer factorial algorithm
18701870
18711871
Based on the formula and pseudo-code provided at:
@@ -1931,7 +1931,7 @@ math_isqrt(PyObject *module, PyObject *n)
19311931
'1'-bits in the binary expansion of n.
19321932
*/
19331933

1934-
/*
1934+
/*
19351935
factorial_partial_product: Compute product(range(start, stop, 2)) using
19361936
divide and conquer. Assumes start and stop are odd and stop > start.
19371937
max_bits must be >= bit_length(stop - 2).
@@ -3290,9 +3290,9 @@ math_isclose_impl(PyObject *module, double a, double b, double rel_tol,
32903290

32913291
diff = fabs(b - a);
32923292

3293-
return (((diff <= fabs(rel_tol * b)) ||
3294-
(diff <= fabs(rel_tol * a))) ||
3295-
(diff <= abs_tol));
3293+
return (diff <= fabs(rel_tol * b)) ||
3294+
(diff <= fabs(rel_tol * a)) ||
3295+
(diff <= abs_tol);
32963296
}
32973297

32983298
static inline int

0 commit comments

Comments
 (0)