Title: ValueError for `math.atan2(0.0, 0.0)` and `cmath.phase(0.0)` using icx · Issue #153144 · python/cpython · GitHub
Open Graph Title: ValueError for `math.atan2(0.0, 0.0)` and `cmath.phase(0.0)` using icx · Issue #153144 · python/cpython
X Title: ValueError for `math.atan2(0.0, 0.0)` and `cmath.phase(0.0)` using icx · Issue #153144 · python/cpython
Description: Bug report Bug description: The math function atan2 and the cmath function phase should not raise ValueError when their arguments are zero. This is true when building CPython using an officially supported compiler such as GCC: >>> import...
Open Graph Description: Bug report Bug description: The math function atan2 and the cmath function phase should not raise ValueError when their arguments are zero. This is true when building CPython using an officially su...
X Description: Bug report Bug description: The math function atan2 and the cmath function phase should not raise ValueError when their arguments are zero. This is true when building CPython using an officially su...
Opengraph URL: https://github.com/python/cpython/issues/153144
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ValueError for `math.atan2(0.0, 0.0)` and `cmath.phase(0.0)` using icx","articleBody":"# Bug report\n\n### Bug description:\n\nThe math function `atan2` and the cmath function `phase` should not raise ValueError when their arguments are zero. This is true when building CPython using an officially supported compiler such as GCC:\n\n```python\n\u003e\u003e\u003e import math\n\u003e\u003e\u003e import cmath\n\u003e\u003e\u003e math.atan2(0.0, 0.0)\n0.0\n\u003e\u003e\u003e cmath.phase(complex(0.0, 0.0))\n0.0\n\u003e\u003e\u003e math.atan2(0.0, -0.0)\n3.141592653589793\n\u003e\u003e\u003e cmath.phase(complex(-0.0, 0.0))\n3.141592653589793\n```\n\nHowever, The C23 standard (ISO/IEC 9899:2024) in section 7.12.4.4 for `atan2` states:\n\u003e A domain error may occur if both arguments are zero.\n\nThe Intel math library version 2026.0.0 sets `errno` to `EDOM` for these cases. See also PR #152825. Thus:\n```python\n\u003e\u003e\u003e import math\n\u003e\u003e\u003e import cmath\n\u003e\u003e\u003e math.atan2(0.0, 0.0)\nTraceback (most recent call last):\n File \"\u003cpython-input-2\u003e\", line 1, in \u003cmodule\u003e\n math.atan2(0.0, 0.0)\n ~~~~~~~~~~^^^^^^^^^^\nValueError: math domain error\n\u003e\u003e\u003e cmath.phase(complex(0.0, 0.0))\nTraceback (most recent call last):\n File \"\u003cpython-input-3\u003e\", line 1, in \u003cmodule\u003e\n cmath.phase(complex(0.0, 0.0))\n ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^\nValueError: math domain error\n\u003e\u003e\u003e math.atan2(0.0, -0.0)\nTraceback (most recent call last):\n File \"\u003cpython-input-4\u003e\", line 1, in \u003cmodule\u003e\n math.atan2(0.0, -0.0)\n ~~~~~~~~~~^^^^^^^^^^^\nValueError: math domain error\n\u003e\u003e\u003e cmath.phase(complex(-0.0, 0.0))\nTraceback (most recent call last):\n File \"\u003cpython-input-5\u003e\", line 1, in \u003cmodule\u003e\n cmath.phase(complex(-0.0, 0.0))\n ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^\nValueError: math domain error\n```\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-153148\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/hpkfft","@type":"Person","name":"hpkfft"},"datePublished":"2026-07-05T18:58:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/153144/cpython/issues/153144"}
| 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:bf2722dc-0b85-7535-af77-309460649062 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE28:2F0FE8:51BA24:6B3277:6A530180 |
| html-safe-nonce | 090edef389e52027956bc9f7560c7bebd28b27d35958df7c98a94e319ef819ff |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTI4OjJGMEZFODo1MUJBMjQ6NkIzMjc3OjZBNTMwMTgwIiwidmlzaXRvcl9pZCI6IjY2ODU5OTE4MDA2NzM1OTk4NzIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3aeb66f074b4f9c5671cce29b0c3a711668b5909baf899882ecd17628a29efa7 |
| hovercard-subject-tag | issue:4814055676 |
| 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/153144/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3e78fe3b4a465746e056c6e24a1b99f01eaa34b8c4c86f2dee5690480bb22efa/python/cpython/issues/153144 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3e78fe3b4a465746e056c6e24a1b99f01eaa34b8c4c86f2dee5690480bb22efa/python/cpython/issues/153144 |
| og:image:alt | Bug report Bug description: The math function atan2 and the cmath function phase should not raise ValueError when their arguments are zero. This is true when building CPython using an officially su... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hpkfft |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| 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 | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width