{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/49048","repository_url":"https://api.github.com/repos/rust-lang/rust","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/49048/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/49048/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/49048/events","html_url":"https://github.com/rust-lang/rust/issues/49048","id":305600066,"number":49048,"title":"Tracking issue for RFC 2169: Euclidean Modulo","user":{"login":"alexcrichton","id":64996,"avatar_url":"https://avatars1.githubusercontent.com/u/64996?v=4","gravatar_id":"","url":"https://api.github.com/users/alexcrichton","html_url":"https://github.com/alexcrichton","followers_url":"https://api.github.com/users/alexcrichton/followers","following_url":"https://api.github.com/users/alexcrichton/following{/other_user}","gists_url":"https://api.github.com/users/alexcrichton/gists{/gist_id}","starred_url":"https://api.github.com/users/alexcrichton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexcrichton/subscriptions","organizations_url":"https://api.github.com/users/alexcrichton/orgs","repos_url":"https://api.github.com/users/alexcrichton/repos","events_url":"https://api.github.com/users/alexcrichton/events{/privacy}","received_events_url":"https://api.github.com/users/alexcrichton/received_events","type":"User","site_admin":false},"labels":[{"id":89436934,"url":"https://api.github.com/repos/rust-lang/rust/labels/B-RFC-approved","name":"B-RFC-approved","color":"d304cb","default":false},{"id":211668062,"url":"https://api.github.com/repos/rust-lang/rust/labels/T-libs","name":"T-libs","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-03-15T15:25:51Z","updated_at":"2018-05-04T18:58:48Z","closed_at":null,"author_association":"OWNER","body":"Tracking issue for rust-lang/rfcs#2169, euclidean modulo methods on numbers\r\n\r\n**Steps**:\r\n\r\n- [x] Implementation\r\n- [ ] Stabilization PR"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/386700954","html_url":"https://github.com/rust-lang/rust/issues/49048#issuecomment-386700954","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/49048","id":386700954,"user":{"login":"clarcharr","id":15850505,"avatar_url":"https://avatars1.githubusercontent.com/u/15850505?v=4","gravatar_id":"","url":"https://api.github.com/users/clarcharr","html_url":"https://github.com/clarcharr","followers_url":"https://api.github.com/users/clarcharr/followers","following_url":"https://api.github.com/users/clarcharr/following{/other_user}","gists_url":"https://api.github.com/users/clarcharr/gists{/gist_id}","starred_url":"https://api.github.com/users/clarcharr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clarcharr/subscriptions","organizations_url":"https://api.github.com/users/clarcharr/orgs","repos_url":"https://api.github.com/users/clarcharr/repos","events_url":"https://api.github.com/users/clarcharr/events{/privacy}","received_events_url":"https://api.github.com/users/clarcharr/received_events","type":"User","site_admin":false},"created_at":"2018-05-04T18:58:48Z","updated_at":"2018-05-04T18:58:48Z","author_association":"CONTRIBUTOR","body":"Also, I messed around with the code and `div_rem_euc` would be:\r\n\r\n```\r\nlet (q, r) = (self / rhs, self % rhs);\r\nif r < 0 {\r\n    if rhs > 0 {\r\n        (q - 1, r - rhs)\r\n    } else {\r\n        (q + 1, r + rhs)\r\n    }\r\n} else {\r\n    (q, r)\r\n}\r\n```\r\n\r\nversus the existing:\r\n\r\n```\r\nlet q = if self % rhs < 0 {\r\n    if rhs > 0 { self / rhs - 1 } else { self / rhs + 1 }\r\n} else {\r\n    q\r\n};\r\nlet r = self % rhs;\r\nlet r = if r < 0 {\r\n    if rhs < 0 {\r\n        r - rhs\r\n    } else {\r\n        r + rhs\r\n    }\r\n} else {\r\n    r\r\n};\r\n```\r\n\r\nAnd I haven't run any benchmarks, but it seems pretty clear that even if LLVM can combine the existing division and remainder into one operation, it probably won't be smart enough to combine the branches. But, if we can write the latter in a way that optimises to the former, I think it'd be reasonable to say that a divrem method isn't necessary."}}
{"actor":{"display_login":"clarcharr"}}