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: github.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:76fcc239-7829-f518-db35-0c6babb14697 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 957A:3AEC12:10F5A2D:173E95E:69694391 |
| html-safe-nonce | 6825be66bafea8bce9ff8cbaaed5555712781bac96af4b52e3d4a12e4dc9cb85 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTdBOjNBRUMxMjoxMEY1QTJEOjE3M0U5NUU6Njk2OTQzOTEiLCJ2aXNpdG9yX2lkIjoiMzM1NTI1NTIwMjQ2MDAyNTc0NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 822f293ff203e245563ec49a40c073b0d9ea9774eee981c8b2e09a14fe5fa5bc |
| 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 | 54182691a21263b584d2e600b758e081b0ff1d10ffc0d2eefa51cf754b43b51d |
| 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 | d69ac0477df0f87da03b8b06cebd187012d7a930 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width