Title: Further improve accuracy of math.hypot() by rhettinger · Pull Request #22013 · python/cpython · GitHub
Open Graph Title: Further improve accuracy of math.hypot() by rhettinger · Pull Request #22013 · python/cpython
X Title: Further improve accuracy of math.hypot() by rhettinger · Pull Request #22013 · python/cpython
Description: When summing the squares, the lossy step occurs during the accumulation of fractional values. We can improve accuracy by keeping a separate accumulator for the frac += lo * lo step so that the small fractional values don't get overpowered by the larger fractional values. As a nice side benefit, the generated code is slightly smaller — it saves two movapd instructions without increasing the number of registers in use.. Also the flow graph has fewer sequential dependencies to interfere with pipelining and parallel execution. I compared having one, two, or three separate fractional value accumulators. For all dimensions, two accumulators are more accurate than just one. Up to a dozen or so dimensions, two accumulators are more accurate than three. See the analysis code at https://bugs.python.org/file49435/best_frac.py https://bugs.python.org/issue41513
Open Graph Description: When summing the squares, the lossy step occurs during the accumulation of fractional values. We can improve accuracy by keeping a separate accumulator for the frac += lo * lo step so that the sma...
X Description: When summing the squares, the lossy step occurs during the accumulation of fractional values. We can improve accuracy by keeping a separate accumulator for the frac += lo * lo step so that the sma...
Opengraph URL: https://github.com/python/cpython/pull/22013
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:afdcb785-b5ab-2a07-47e5-fdc71f369f29 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 907A:2BFBB8:221CE08:2E7C533:696ACF65 |
| html-safe-nonce | dab8f1371c9c1ae2d5b78399882919f1462660c46f567d8430018148e8f616a7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDdBOjJCRkJCODoyMjFDRTA4OjJFN0M1MzM6Njk2QUNGNjUiLCJ2aXNpdG9yX2lkIjoiMTg2MTc3MDE4NDU4MTg5Mzk4OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b08f6f9bf342c055b4c98baca14816ada172b51f8f9ab2115ba19ff42673548d |
| hovercard-subject-tag | pull_request:475856507 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/22013/files |
| twitter:image | https://avatars.githubusercontent.com/u/1623689?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1623689?s=400&v=4 |
| og:image:alt | When summing the squares, the lossy step occurs during the accumulation of fractional values. We can improve accuracy by keeping a separate accumulator for the frac += lo * lo step so that the sma... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width