Title: IEEE floating point signalling bit can be inverted on MIPS (Python assumes its not) · Issue #104263 · python/cpython · GitHub
Open Graph Title: IEEE floating point signalling bit can be inverted on MIPS (Python assumes its not) · Issue #104263 · python/cpython
X Title: IEEE floating point signalling bit can be inverted on MIPS (Python assumes its not) · Issue #104263 · python/cpython
Description: Probably better links for this, but on MIPS, the floating point signalling bit seems typically inverted: https://sourceware.org/binutils/docs/as/MIPS-NaN-Encodings.html However, Python's _Py_dg_stdnan should create quiet NaNs, but hard-c...
Open Graph Description: Probably better links for this, but on MIPS, the floating point signalling bit seems typically inverted: https://sourceware.org/binutils/docs/as/MIPS-NaN-Encodings.html However, Python's _Py_dg_std...
X Description: Probably better links for this, but on MIPS, the floating point signalling bit seems typically inverted: https://sourceware.org/binutils/docs/as/MIPS-NaN-Encodings.html However, Python's _Py_dg...
Opengraph URL: https://github.com/python/cpython/issues/104263
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"IEEE floating point signalling bit can be inverted on MIPS (Python assumes its not)","articleBody":"Probably better links for this, but on MIPS, the floating point signalling bit seems typically inverted: https://sourceware.org/binutils/docs/as/MIPS-NaN-Encodings.html\r\n\r\nHowever, Python's [_Py_dg_stdnan](https://github.com/python/cpython/blob/45a9e3834a6ed20ee250e2e5a8583dffcef0eb73/Python/dtoa.c#L1409-L1418) should create quiet NaNs, but hard-codes the bit to 0.\r\n\r\nThis again continues to do weird things if mixed with NumPy apparently visible in some `fmin` downstream test failures (to be clear, I don't think the signalling bit _should_ matter for that, but it is incorrect anyway; the bit should never be set in our part of the world). (See https://github.com/numpy/numpy/issues/23158)\r\n\r\nTo me, all of that is a bit moot though. Python has this manual definition for NaN and Inf, but also defines `Py_NAN` and `Py_HUGE_VAL`. In theory, `Py_HUGE_VAL` doesn't need to be inf and `Py_NAN` I am not actually sure what it could be if NaN is not available...\r\n\r\nBut... If you have IEEE doubles and setting the bit-pattern manually is reasonable. You certainly can assume that both are defined to the right thing and `Py_NAN` is in fact a `NaN` value. Doing that simplifies the code, but should also solve the MIPS issue since `Py_NAN` presumably is correctly defined to a quiet NaN.\r\n\r\nThis is done in gh-104202. I suppose a test might be:\r\n```\r\nif hasattr(math, \"nan\"):\r\n bits_nan1 = struct.pack(\"d\", math.inf - math.inf)\r\n bits_nan2 = struct.pack(\"d\", math.nan)\r\n assert bits_nan1 == bits_nan2\r\n```","author":{"url":"https://github.com/seberg","@type":"Person","name":"seberg"},"datePublished":"2023-05-07T08:04:33.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":13},"url":"https://github.com/104263/cpython/issues/104263"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f81959bf-bf08-60e3-5824-f131abf05adb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CA26:861EA:A536F7:DE11D7:69699236 |
| html-safe-nonce | 8ef33f88c7fdfd8a5aa80000f919c98dc33c42d9dce785319a83f64803f3aad8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTI2Ojg2MUVBOkE1MzZGNzpERTExRDc6Njk2OTkyMzYiLCJ2aXNpdG9yX2lkIjoiNjEzMzQ4OTIxMjQ0MTA0MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c22f88536e4ba112f6a789e06edcefd948881f2a2545a3aec321f180d4fa9ca5 |
| hovercard-subject-tag | issue:1698948217 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/104263/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3ae8958e91886e26215da6598260cfb9046ae3e76a2c7738a119b4dcee765f19/python/cpython/issues/104263 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3ae8958e91886e26215da6598260cfb9046ae3e76a2c7738a119b4dcee765f19/python/cpython/issues/104263 |
| og:image:alt | Probably better links for this, but on MIPS, the floating point signalling bit seems typically inverted: https://sourceware.org/binutils/docs/as/MIPS-NaN-Encodings.html However, Python's _Py_dg_std... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | seberg |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3542e147982176a7ebaa23dfb559c8af16f721c03ec560c68c56b64a0f35e751 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | af80af7cc9e3de9c336f18b208a600950a3c187c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width