Title: Complex addition/subtraction is not commutative · Issue #585 · oracle/graalpython · GitHub
Open Graph Title: Complex addition/subtraction is not commutative · Issue #585 · oracle/graalpython
X Title: Complex addition/subtraction is not commutative · Issue #585 · oracle/graalpython
Description: Python 3.12.8 (Thu Oct 09 17:26:36 UTC 2025) [Graal, Oracle GraalVM, Java 25.0.1 (amd64)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> x = 0; y = complex(0.0,-0.0) >>> y+x -0j >>> x+y 0j It seems, t...
Open Graph Description: Python 3.12.8 (Thu Oct 09 17:26:36 UTC 2025) [Graal, Oracle GraalVM, Java 25.0.1 (amd64)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> x = 0; y = complex(0.0,...
X Description: Python 3.12.8 (Thu Oct 09 17:26:36 UTC 2025) [Graal, Oracle GraalVM, Java 25.0.1 (amd64)] on linux Type "help", "copyright", "credits" or "license" for more ...
Opengraph URL: https://github.com/oracle/graalpython/issues/585
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Complex addition/subtraction is not commutative","articleBody":"```pycon\nPython 3.12.8 (Thu Oct 09 17:26:36 UTC 2025)\n[Graal, Oracle GraalVM, Java 25.0.1 (amd64)] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\u003e\u003e\u003e x = 0; y = complex(0.0,-0.0)\n\u003e\u003e\u003e y+x\n-0j\n\u003e\u003e\u003e x+y\n0j\n```\n\nIt seems, this happens because specialization exists for complex+int (and complex+float) case, but not for int+complex:\nhttps://github.com/oracle/graalpython/blob/b12073bc3a6d11a07a54e49a87e07c22bf4dc1b0/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/complex/ComplexBuiltins.java#L960-L971\n\nSame for subtraction:\nhttps://github.com/oracle/graalpython/blob/b12073bc3a6d11a07a54e49a87e07c22bf4dc1b0/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/complex/ComplexBuiltins.java#L1077\n\nN.B.: CPython before v3.14 had no special arithmetic rules for mixed-type operands (real values silently converted to complex type with a zero imaginary part).","author":{"url":"https://github.com/skirpichev","@type":"Person","name":"skirpichev"},"datePublished":"2025-12-23T10:26:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/585/graalpython/issues/585"}
| 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:37c93631-0d4b-0fc8-1136-91099edeb4b3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 84E2:3945BB:329E210:43A5104:696F2565 |
| html-safe-nonce | 11c73d693bf12feeb5f14f1e92a501c28f9b2f14ff4db145305e78d2031c0bd9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NEUyOjM5NDVCQjozMjlFMjEwOjQzQTUxMDQ6Njk2RjI1NjUiLCJ2aXNpdG9yX2lkIjoiNzkwMTIwMjE1OTM5NzQ0NzAxMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 59c069f79bb07137a2967d2baef46c25c9014a4be55a76189b2776768b06ee9d |
| hovercard-subject-tag | issue:3756885014 |
| 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/oracle/graalpython/585/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1af9eaebcdd3b575b62da5a2ebfe70c0efcd400d02032f105053ef04fdca34ab/oracle/graalpython/issues/585 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1af9eaebcdd3b575b62da5a2ebfe70c0efcd400d02032f105053ef04fdca34ab/oracle/graalpython/issues/585 |
| og:image:alt | Python 3.12.8 (Thu Oct 09 17:26:36 UTC 2025) [Graal, Oracle GraalVM, Java 25.0.1 (amd64)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> x = 0; y = complex(0.0,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | skirpichev |
| hostname | github.com |
| expected-hostname | github.com |
| None | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| turbo-cache-control | no-preview |
| go-import | github.com/oracle/graalpython git https://github.com/oracle/graalpython.git |
| octolytics-dimension-user_id | 4430336 |
| octolytics-dimension-user_login | oracle |
| octolytics-dimension-repository_id | 129883600 |
| octolytics-dimension-repository_nwo | oracle/graalpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 129883600 |
| octolytics-dimension-repository_network_root_nwo | oracle/graalpython |
| 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 | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width