Title: numberFilter unnecessary string to number to string conversion => precision issue · Issue #16175 · angular/angular.js · GitHub
Open Graph Title: numberFilter unnecessary string to number to string conversion => precision issue · Issue #16175 · angular/angular.js
X Title: numberFilter unnecessary string to number to string conversion => precision issue · Issue #16175 · angular/angular.js
Description: I'm submitting a ... bug report feature request other (Please do not submit support requests here (see above)) Current behavior: '9999999999999999' | number:0 => 10,000,000,000,000,000 9999999999999999 | number:0 => 10,000,000,000,000,00...
Open Graph Description: I'm submitting a ... bug report feature request other (Please do not submit support requests here (see above)) Current behavior: '9999999999999999' | number:0 => 10,000,000,000,000,000 999999999999...
X Description: I'm submitting a ... bug report feature request other (Please do not submit support requests here (see above)) Current behavior: '9999999999999999' | number:0 => 10,000,000,000,000,0...
Opengraph URL: https://github.com/angular/angular.js/issues/16175
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"numberFilter unnecessary string to number to string conversion => precision issue","articleBody":"**I'm submitting a ...**\r\n\u003c!-- (check one with \"x\") -->\r\n- [x] bug report\r\n- [ ] feature request\r\n- [ ] other (Please do not submit support requests here (see above))\r\n\r\n**Current behavior:**\r\n`'9999999999999999' | number:0 => 10,000,000,000,000,000`\r\n`9999999999999999 | number:0 => 10,000,000,000,000,000`\r\n\r\n\r\n**Expected / new behavior:**\r\n`'9999999999999999' | number:0 => 9,999,999,999,999,999`\r\n`9999999999999999 | number:0 => 10,000,000,000,000,000`\r\n\r\n\r\n**Minimal reproduction of the problem with instructions:**\r\nsee [plnkr](http://plnkr.co/edit/KcjebI6KLL6CgW8ap4Ci)\r\n\r\n**AngularJS version:** \r\nall\r\n\r\n**Browser:**\r\nall\r\n**Anything else:**\r\nthe problem stems from an - in my opinion - unnecessary conversion from string to number to string in the formatNumber function. basically just to remove the sign from the string with Math.abs().\r\ndoing something like the snipped below would allow to correctly format string number presentation - without limits of number precision (up to the limits defined by the rest of the code).\r\nin some cases this is enough and one does not have to go for a big(int|number) implementation with corresponding localised formatters.\r\n```\r\nvar numStr = isString(number) ? (number.startsWith('-') || number.startsWith('+') ? number.substring(1): number) : Math.abs(number) + ''\r\n```","author":{"url":"https://github.com/msperisen","@type":"Person","name":"msperisen"},"datePublished":"2017-08-15T16:33:40Z","url":"https://github.com/angular/angular.js/issues/16175"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:d0f7e224-d390-fbeb-ccc3-77ea0684c045 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D3F0:274D5F:808BCA:B9D9AA:6AFD8506 |
| html-safe-nonce | 40e7d19484ecabab92aae63f621ea48e3f661e18a329b1392d5a217b7dc2cd2f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEM0YwOjI3NEQ1Rjo4MDhCQ0E6QjlEOUFBOjZBRkQ4NTA2IiwidmlzaXRvcl9pZCI6IjU0NzIyOTk5MjY2MDg2MjIxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c81739ca3ffc8a44856cc16173ed2a41cee9800b256e973fe07b70e961bd2601 |
| hovercard-subject-tag | issue:250367885 |
| 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/angular/angular.js/16175/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9ac338a570d84281227ea74dd7801825063839e159aa5ab99785337d1741760d/angular/angular.js/issues/16175 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9ac338a570d84281227ea74dd7801825063839e159aa5ab99785337d1741760d/angular/angular.js/issues/16175 |
| og:image:alt | I'm submitting a ... bug report feature request other (Please do not submit support requests here (see above)) Current behavior: '9999999999999999' | number:0 => 10,000,000,000,000,000 999999999999... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | msperisen |
| hostname | github.com |
| expected-hostname | github.com |
| None | bc86424ef34a73b386237872800e922d149d65ba907f63d6f150a2dcb8433bea |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular.js git https://github.com/angular/angular.js.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 460078 |
| octolytics-dimension-repository_nwo | angular/angular.js |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 460078 |
| octolytics-dimension-repository_network_root_nwo | angular/angular.js |
| 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 | 927a6c5ab1c32b38830f1b9d3050c0b9e9aa92e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width