Skip to content

Commit 0db375b

Browse files
eendebakptclaude
andcommitted
gh-NNNN: Remove _Py_dg_strtod() from dtoa.c
_Py_dg_strtod() and its helper functions (s2b, hi0bits used only by s2b, b2d, sd2b, ratio, BCinfo, sulp, bigcomp, plus the tens/bigtens tables used only by strtod) are removed — 1075 net lines deleted. String-to-double conversion is now handled by _PyWuffs_strtod() (added in the previous commit) which combines the Eisel-Lemire fast path with Wuffs's High Precision Decimal fallback for 100% correct rounding. The Bigint infrastructure (Balloc, Bfree, multadd, mult, lshift, diff, cmp, pow5mult, i2b) and the functions still needed by _Py_dg_dtoa (hi0bits, lo0bits, d2b, tens, bigtens, dshift, quorem) are retained. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2f21cac commit 0db375b

File tree

3 files changed

+78
-1153
lines changed

3 files changed

+78
-1153
lines changed

Include/internal/pycore_dtoa.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ extern "C" {
2424
}
2525
#endif
2626

27-
extern double _Py_dg_strtod(const char *str, char **ptr);
2827
extern char* _Py_dg_dtoa(double d, int mode, int ndigits,
2928
int *decpt, int *sign, char **rve);
3029
extern void _Py_dg_freedtoa(char *s);

Include/internal/pycore_pymath.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ static inline void _Py_ADJUST_ERANGE2(double x, double y)
5959

6060
//--- HAVE_PY_SET_53BIT_PRECISION macro ------------------------------------
6161
//
62-
// The functions _Py_dg_strtod() and _Py_dg_dtoa() in Python/dtoa.c (which are
63-
// required to support the short float repr introduced in Python 3.1) require
64-
// that the floating-point unit that's being used for arithmetic operations on
65-
// C doubles is set to use 53-bit precision. It also requires that the FPU
66-
// rounding mode is round-half-to-even, but that's less often an issue.
62+
// The function _Py_dg_dtoa() in Python/dtoa.c (which is required to support
63+
// the short float repr introduced in Python 3.1) and _PyWuffs_strtod() in
64+
// Python/_ryu/pystrtod_wuffs.h require that the floating-point unit that's
65+
// being used for arithmetic operations on C doubles is set to use 53-bit
66+
// precision. It also requires that the FPU rounding mode is
67+
// round-half-to-even, but that's less often an issue.
6768
//
6869
// If your FPU isn't already set to 53-bit precision/round-half-to-even, and
69-
// you want to make use of _Py_dg_strtod() and _Py_dg_dtoa(), then you should:
70+
// you want to make use of _PyWuffs_strtod() and _Py_dg_dtoa(), then you should:
7071
//
7172
// #define HAVE_PY_SET_53BIT_PRECISION 1
7273
//

0 commit comments

Comments
 (0)