Skip to content
Prev Previous commit
Merge branch 'main' into math-log-int-like-overflow
  • Loading branch information
serhiy-storchaka committed Nov 11, 2025
commit 4c37a25b5503918da618ae00e61581f336fa87ff
3 changes: 2 additions & 1 deletion Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ raised for division by zero and mod by zero.
#endif

#include "Python.h"
#include "pycore_abstract.h" // _PyNumber_Index()
#include "pycore_bitutils.h" // _Py_bit_length()
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_import.h" // _PyImport_SetModuleString()
Expand Down Expand Up @@ -1601,7 +1602,7 @@ loghelper_int(PyObject* arg, double (*func)(double))
x = _PyLong_Frexp((PyLongObject *)arg, &e);
assert(!PyErr_Occurred());
/* Value is ~= x * 2**e, so the log ~= log(x) + log(2) * e. */
result = func(x) + func(2.0) * e;
result = fma(func(2.0), (double)e, func(x));
}
else
/* Successfully converted x to a double. */
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.