{"action":"closed","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/16755","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/16755/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/16755/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/16755/events","html_url":"https://github.com/rust-lang/rust/issues/16755","id":41117061,"number":16755,"title":"`std::num::pow`: exponent should not be a `uint`","user":{"login":"vks","id":33460,"avatar_url":"https://avatars.githubusercontent.com/u/33460?v=3","gravatar_id":"","url":"https://api.github.com/users/vks","html_url":"https://github.com/vks","followers_url":"https://api.github.com/users/vks/followers","following_url":"https://api.github.com/users/vks/following{/other_user}","gists_url":"https://api.github.com/users/vks/gists{/gist_id}","starred_url":"https://api.github.com/users/vks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vks/subscriptions","organizations_url":"https://api.github.com/users/vks/orgs","repos_url":"https://api.github.com/users/vks/repos","events_url":"https://api.github.com/users/vks/events{/privacy}","received_events_url":"https://api.github.com/users/vks/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2014-08-25T22:39:50Z","updated_at":"2015-01-21T20:45:51Z","closed_at":"2015-01-21T20:45:51Z","body":"Right now `pow` has the following signature:\r\n\r\n```rust\r\npub fn pow<T: One + Mul<T, T>>(base: T, exp: uint) -> T\r\n```\r\n\r\nIt does not really make sense that the exponent is a pointer-sized `uint`. This makes this function unnecessarily platform-dependent.\r\nAlso, it is awkward to use with `BigInt` as an exponent. (This mainly an ergonomic issue, as a `uint` should be large enough to store any reasonable exponent.)\r\n\r\nI think it would be better to have a signature like\r\n\r\n```rust\r\npub fn pow<T: One + Mul<T, T>, U: One + Zero + Add<U, U> + Div<U,U>>(base: T, exp: U) -> T\r\n```\r\n\r\n(Note that `pow` currently uses some bitwise operations for efficiency, the proposed type constraints do not reflect that.)\r\n\r\nAlternatively, to keep it simple the exponent could just be a constant-size unsigned integer (`u32` should be sufficient [1]).\r\n\r\n[1] pow(1.1, pow(2, 32)) ~= pow(10, 177780229)\r\n"}}