Skip to content

Commit

Permalink
Move local declarations inside the block where they are used.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettinger committed Dec 23, 2022
1 parent 4f4b731 commit 4da0b8f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2533,7 +2533,6 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
if (PyFloat_CheckExact(result)) {
double f_result = PyFloat_AS_DOUBLE(result);
double c = 0.0;
double x, t;
Py_SETREF(result, NULL);
while(result == NULL) {
item = PyIter_Next(iter);
Expand All @@ -2552,8 +2551,8 @@ builtin_sum_impl(PyObject *module, PyObject *iterable, PyObject *start)
if (PyFloat_CheckExact(item)) {
// Improved Kahan–Babuška algorithm by Arnold Neumaier
// https://www.mat.univie.ac.at/~neum/scan/01.pdf
x = PyFloat_AS_DOUBLE(item);
t = f_result + x;
double x = PyFloat_AS_DOUBLE(item);
double t = f_result + x;
if (fabs(f_result) >= fabs(x)) {
c += (f_result - t) + x;
} else {
Expand Down

0 comments on commit 4da0b8f

Please sign in to comment.