Skip to content

Commit 4de2fb8

Browse files
committed
Fix size of cached powers of 5 array.
We need the powers of 5 up to 5**512 because we only jump straight to underflow when the exponent is less than -512 (or larger than 308).
1 parent d53c7f4 commit 4de2fb8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Include/internal/pycore_dtoa.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ struct _dtoa_state {
3636
#define Bigint_Kmax 7
3737

3838
/* The size of the cached powers of 5 array */
39-
#define Bigint_Pow5max 7
39+
#define Bigint_Pow5max 8
4040

4141
#ifndef PRIVATE_MEM
4242
#define PRIVATE_MEM 2304

Python/dtoa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2807,7 +2807,7 @@ _PyDtoa_Init(PyInterpreterState *interp)
28072807
}
28082808
p5s[0] = p5;
28092809

2810-
// compute 5**8, 5**16, 5**32, ..., 5**256
2810+
// compute 5**8, 5**16, 5**32, ..., 5**512
28112811
for (Py_ssize_t i = 1; i < Bigint_Pow5max; i++) {
28122812
p5 = mult(p5, p5);
28132813
if (p5 == NULL) {

0 commit comments

Comments
 (0)