Files
meta-openembedded/meta-python/recipes-devtools/python/python3-fastnumbers_5.2.0.bb
T
Khem Raj 9bfe6f0ea9 python3-fastnumbers: fix denoise of large floats when built with clang
float_as_int_without_noise() returns early when the floored value fits
in a long, checking it with floor_val == static_cast<long>(floor_val).
For values outside the range of long the conversion is undefined
behavior; clang -O2 folds the round trip into "floor_val is integral",
which is always true, so the denoising is skipped:

  FAIL: tests/test_fastnumbers_examples.py:test_try_real
  FAIL: tests/test_fastnumbers_examples.py:test_try_forceint
  assert 3452999999999999737856 == 3453000000000000000000

Add a patch that only does the conversion when the value is in range.
A reduced reproducer returns the wrong answer with the recipe's clang++
at -O2 and the right one with the fix (and with -O0 or gcc).

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
2026-09-12 16:52:16 -07:00

20 lines
599 B
BlitzBasic

SUMMARY = "Super-fast and clean conversions to numbers."
SECTION = "devel/python"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=d32431d1b650010945da4e078011c8fa"
SRC_URI += "file://0001-parser-avoid-undefined-double-to-long-conversion-in-.patch"
SRC_URI[sha256sum] = "07266a2fca9e08eeb5a6c70be4c8db3637db9b930ea5198facbbb9b0b31d4d03"
inherit pypi python_setuptools_build_meta ptest-python-pytest
DEPENDS += "python3-setuptools-scm-native"
RDEPENDS:${PN}-ptest += "\
python3-ctypes \
python3-hypothesis \
python3-numpy \
python3-typing-extensions \
"