Closed jasilummer closed 4 months ago
What's the value of _PY_SHORT_FLOAT_REPR? Look in pyconfig.h file.
The structure is defined in Include/internal/pycore_dtoa.h.
Ah wait, the macro is defined in: Include/internal/pycore_pymath.h
//--- _PY_SHORT_FLOAT_REPR macro -------------------------------------------
// If we can't guarantee 53-bit precision, don't use the code
// in Python/dtoa.c, but fall back to standard code. This
// means that repr of a float will be long (17 significant digits).
//
// Realistically, there are two things that could go wrong:
//
// (1) doubles aren't IEEE 754 doubles, or
// (2) we're on x86 with the rounding precision set to 64-bits
// (extended precision), and we don't know how to change
// the rounding precision.
#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \
!defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \
!defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)
# define _PY_SHORT_FLOAT_REPR 0
#endif
// Double rounding is symptomatic of use of extended precision on x86.
// If we're seeing double rounding, and we don't have any mechanism available
// for changing the FPU rounding precision, then don't use Python/dtoa.c.
#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION)
# define _PY_SHORT_FLOAT_REPR 0
#endif
#ifndef _PY_SHORT_FLOAT_REPR
# define _PY_SHORT_FLOAT_REPR 1
#endif
The same happens when building for armv7l-unknown-linux-musleabihf
and armv7l-unknown-linux-gnueabihf
and riscv64-unknown-linux-gnu
bisected the failure on armv7l-unknown-linux-gnueabihf to 3c57971a2d3b6d2c6fd1f525ba2108fccb35add2
Fixed by https://github.com/python/cpython/commit/c3677befbecbd7fa94cde8c1fecaa4cc18e6aa2b thank to @yu-re-ka. Backports will follow. Thanks for the report.
Bug report
Bug description:
CPython versions tested on:
3.12
Operating systems tested on:
Other
Linked PRs