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/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:bf341f98-172d-1fcd-13c5-54a8803758fc |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | D5C0:29957D:F21BF0:14E9885:696A9465 |
| html-safe-nonce | c309c090b548290eed01bb8e6a3d76007d7b548da9b07874ef86bf88ea21c5ca |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENUMwOjI5OTU3RDpGMjFCRjA6MTRFOTg4NTo2OTZBOTQ2NSIsInZpc2l0b3JfaWQiOiI1OTE4ODY0NDI2NDgyMTI1ODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 1b9d1bbea1313c8824bd1b48066eec8f047ddb11f5858f5e419beb46ea100070 |
| hovercard-subject-tag | pull_request:475856507 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,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/checks |
| 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 | 4dd496afc954da9c207b2d9fbe86e3074619f565754aa1d9274aec30d9e5b8d7 |
| 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 full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 31496a13b80a2f6ad77d6c617ee2255a3545b539 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width