Summary
On the FPU variants (68020fpu, 68040), math.pow(-1.0, float("nan"))
returns 1.0 instead of NaN, so the NaN-propagation guard fails:
>>> import math
>>> math.pow(-1.0, float("nan"))
1.0 # expected: nan
This trips tests/ports/amiga/test_floatconv_smoke.py:57
(assert math.isnan(math.pow(-1.0, nan))) with an AssertionError.
Affected / not affected
| Variant |
pow(-1, NaN) |
floatconv test |
standard (soft-float) |
nan ✅ |
passes |
68020fpu |
1.0 ❌ |
fails @ line 57 |
68040 |
1.0 ❌ |
fails @ line 57 |
Root cause (hypothesis)
The port works around libnix/bebbo's non-IEEE pow(-1, NaN) -> 1.0 with a
linker-wrapped __wrap_pow (ports/amiga/floatconv.c:260, wired via
-Wl,--wrap=pow,--wrap=tgamma in ports/amiga/Makefile:97).
The wrap is effective on the soft-float build but appears not to be
applied on the FPU builds — the FPU variants presumably reach pow
through a different symbol/inlined FPU path that --wrap=pow doesn't
intercept, so the unpatched libnix behaviour leaks through. The
tgamma wrap (gamma(-inf)) likely has the same exposure and should be
checked alongside.
Reproduction
ports/amiga/tools/amiga-build.sh 68020fpu
# On Amiberry (68020/68881-82) or real FPU hardware:
micropython tests/ports/amiga/test_floatconv_smoke.py
# -> Traceback ... line 57, in <module> AssertionError
Cannot be reproduced under vamos — its 68040 FPU emulation is not faithful
enough (the test is documented standard-only for vamos for that reason).
Verified on Amiberry with cpu_type=68020/68881, fpu_model=68882.
Pre-existing
Not a regression in the v1.28.0-amiga release — the current development
branch (amiga-port) FPU binary fails identically at the same line on
Amiberry. Filing so the FPU-variant __wrap_pow/__wrap_tgamma gap is
tracked independently of the release.
Possible directions
- Confirm whether
pow/tgamma are actually emitted as calls on the FPU
builds (check the linker map / nm for __wrap_pow vs pow references).
- If the FPU build inlines or routes math through a different symbol,
extend the wrap set or handle NaN propagation in floatconv.c in a way
that survives the FPU codegen path.
- Add an FPU-variant assertion to the test matrix once fixed.
Summary
On the FPU variants (
68020fpu,68040),math.pow(-1.0, float("nan"))returns
1.0instead ofNaN, so the NaN-propagation guard fails:This trips
tests/ports/amiga/test_floatconv_smoke.py:57(
assert math.isnan(math.pow(-1.0, nan))) with anAssertionError.Affected / not affected
pow(-1, NaN)standard(soft-float)nan✅68020fpu1.0❌680401.0❌Root cause (hypothesis)
The port works around libnix/bebbo's non-IEEE
pow(-1, NaN) -> 1.0with alinker-wrapped
__wrap_pow(ports/amiga/floatconv.c:260, wired via-Wl,--wrap=pow,--wrap=tgammainports/amiga/Makefile:97).The wrap is effective on the soft-float build but appears not to be
applied on the FPU builds — the FPU variants presumably reach
powthrough a different symbol/inlined FPU path that
--wrap=powdoesn'tintercept, so the unpatched libnix behaviour leaks through. The
tgammawrap (gamma(-inf)) likely has the same exposure and should bechecked alongside.
Reproduction
Cannot be reproduced under vamos — its 68040 FPU emulation is not faithful
enough (the test is documented
standard-only for vamos for that reason).Verified on Amiberry with
cpu_type=68020/68881,fpu_model=68882.Pre-existing
Not a regression in the
v1.28.0-amigarelease — the current developmentbranch (
amiga-port) FPU binary fails identically at the same line onAmiberry. Filing so the FPU-variant
__wrap_pow/__wrap_tgammagap istracked independently of the release.
Possible directions
pow/tgammaare actually emitted as calls on the FPUbuilds (check the linker map /
nmfor__wrap_powvspowreferences).extend the wrap set or handle NaN propagation in
floatconv.cin a waythat survives the FPU codegen path.