Title: Let math.nextafter() compute multiple steps at a time. · Issue #94906 · python/cpython · GitHub
Open Graph Title: Let math.nextafter() compute multiple steps at a time. · Issue #94906 · python/cpython
X Title: Let math.nextafter() compute multiple steps at a time. · Issue #94906 · python/cpython
Description: Sometimes math.nextafter() needs to be applied multiple times in succession. x = nextafter(nextafter( nextafter(x, inf), inf), inf) # Three steps up It would be nice if the function supported this directly: x = nextafter(x, inf, n=3) The...
Open Graph Description: Sometimes math.nextafter() needs to be applied multiple times in succession. x = nextafter(nextafter( nextafter(x, inf), inf), inf) # Three steps up It would be nice if the function supported this ...
X Description: Sometimes math.nextafter() needs to be applied multiple times in succession. x = nextafter(nextafter( nextafter(x, inf), inf), inf) # Three steps up It would be nice if the function supported this ...
Opengraph URL: https://github.com/python/cpython/issues/94906
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Let math.nextafter() compute multiple steps at a time.","articleBody":"Sometimes ``math.nextafter()`` needs to be applied multiple times in succession. \r\n\r\n x = nextafter(nextafter( nextafter(x, inf), inf), inf) # Three steps up\r\n\r\n It would be nice if the function supported this directly:\r\n\r\n x = nextafter(x, inf, n=3)\r\n\r\nThe implementation would just be a for-loop:\r\n\r\n```\r\ndef newnextafter(x, y, /, *, n=1):\r\n 'Return the floating-point value n steps after x towards y.'\r\n for i in range(n):\r\n x = nextafter(x, y)\r\n return x\r\n```\r\n\r\nThe formal paramater can be just ``n`` or the longer but more descriptive ``steps``.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103881\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/rhettinger","@type":"Person","name":"rhettinger"},"datePublished":"2022-07-16T16:41:46.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":18},"url":"https://github.com/94906/cpython/issues/94906"}
| 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:fb141e48-377d-0712-9ed6-47da7d86d118 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DB0:2AA429:4507D8:5FE671:696A211A |
| html-safe-nonce | 3548b44332338eecbbf825fd154dfac57e59fbe80975976a6c650eaba79cd483 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REIwOjJBQTQyOTo0NTA3RDg6NUZFNjcxOjY5NkEyMTFBIiwidmlzaXRvcl9pZCI6IjMyNjUzNDY3MjM2MTI1OTg1NTQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1adc2d3144f1f62e7dbd7d2ff1b903aac314d35f41d7bf9abfb80d71c61a884f |
| hovercard-subject-tag | issue:1306851641 |
| 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/94906/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5b1ffbafcb338f25751c07a990492ceb0a69f86cc184b1571628fb2f3dfc5bfa/python/cpython/issues/94906 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5b1ffbafcb338f25751c07a990492ceb0a69f86cc184b1571628fb2f3dfc5bfa/python/cpython/issues/94906 |
| og:image:alt | Sometimes math.nextafter() needs to be applied multiple times in succession. x = nextafter(nextafter( nextafter(x, inf), inf), inf) # Three steps up It would be nice if the function supported this ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rhettinger |
| hostname | github.com |
| expected-hostname | github.com |
| None | 014f3d193f36b7d393f88ca22d06fbacd370800b40a547c1ea67291e02dc8ea3 |
| 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 | d515f6f09fa57a93bf90355cb894eb84ca4f458f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width