gh-131032: Fix math.fma(x, y, z) zero sign#131134
Conversation
Fix result sign when z is zero. Co-Authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
!buildbot wasi |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @skirpichev for commit c95e6f9 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131134%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit c95e6f9 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131134%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
Nice, test_math pass on WASI buildbots. |
Sorry, something went wrong.
Sorry, something went wrong.
|
test_fma_zero_result() failed on Android and FreeBSD.
Unrelated failure: test_bigmem failed.
Unrelated failure: |
Sorry, something went wrong.
|
Test failing on Android and FreeBSD: # Corner case where rounding the multiplication would
# give the wrong result.
x = float.fromhex('0x1p-500')
y = float.fromhex('0x1p-550')
z = float.fromhex('0x1p-1000')
self.assertIsNegativeZero(math.fma(x-y, x+y, -z))
self.assertIsPositiveZero(math.fma(y-x, x+y, z))
self.assertIsNegativeZero(math.fma(y-x, -(x+y), -z))
self.assertIsPositiveZero(math.fma(x-y, -(x+y), z))z is not zero in this case. |
Sorry, something went wrong.
|
Proposed patch affects only case when the last argument ( Netbsd failure also seems related to |
Sorry, something went wrong.
|
!buildbot wasi |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit 4e7c5ab 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131134%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Sorry, something went wrong.
|
!buildbot FreeBSD |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit 4e7c5ab 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131134%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Sorry, something went wrong.
|
!buildbot Android |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit 4e7c5ab 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131134%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit 4e7c5ab 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F131134%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
|
It looks this PR does not fix the real issue. It only handles one specific case To handle all cases, we need to implement |
Sorry, something went wrong.
Well, linked issue is a real one. Though, I expected more such cases. (Maybe WASI too?) #131071 is an alternative. BTW, I think that test_fma_zero_result() could be split in that pr as well.
That's true. Only simple workarounds were considered, not implementation of fma() from scratch.
Maybe. But in this case our test suite lacks tests to trigger this. I think that at least failure with musl C stdlib may be related only to arguments with special values. |
Sorry, something went wrong.
|
@serhiy-storchaka is against this workaround: #131134 (comment). I abandon this approach. |
Sorry, something went wrong.
Fix result sign when z is zero.