{"action":"opened","issue":{"url":"https://api.github.com/repos/chapel-lang/chapel/issues/10287","repository_url":"https://api.github.com/repos/chapel-lang/chapel","labels_url":"https://api.github.com/repos/chapel-lang/chapel/issues/10287/labels{/name}","comments_url":"https://api.github.com/repos/chapel-lang/chapel/issues/10287/comments","events_url":"https://api.github.com/repos/chapel-lang/chapel/issues/10287/events","html_url":"https://github.com/chapel-lang/chapel/issues/10287","id":340419297,"node_id":"MDU6SXNzdWUzNDA0MTkyOTc=","number":10287,"title":"Expected behavior for negative bigint to uint casts?","user":{"login":"ronawho","id":1588337,"node_id":"MDQ6VXNlcjE1ODgzMzc=","avatar_url":"https://avatars1.githubusercontent.com/u/1588337?v=4","gravatar_id":"","url":"https://api.github.com/users/ronawho","html_url":"https://github.com/ronawho","followers_url":"https://api.github.com/users/ronawho/followers","following_url":"https://api.github.com/users/ronawho/following{/other_user}","gists_url":"https://api.github.com/users/ronawho/gists{/gist_id}","starred_url":"https://api.github.com/users/ronawho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronawho/subscriptions","organizations_url":"https://api.github.com/users/ronawho/orgs","repos_url":"https://api.github.com/users/ronawho/repos","events_url":"https://api.github.com/users/ronawho/events{/privacy}","received_events_url":"https://api.github.com/users/ronawho/received_events","type":"User","site_admin":false},"labels":[{"id":496591534,"node_id":"MDU6TGFiZWw0OTY1OTE1MzQ=","url":"https://api.github.com/repos/chapel-lang/chapel/labels/area:%20Modules","name":"area: Modules","color":"d4c5f9","default":false},{"id":112762321,"node_id":"MDU6TGFiZWwxMTI3NjIzMjE=","url":"https://api.github.com/repos/chapel-lang/chapel/labels/type:%20Design","name":"type: Design","color":"e99695","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-11T21:53:45Z","updated_at":"2018-07-11T21:53:45Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"As of https://github.com/chapel-lang/chapel/pull/10272, casting a negative `bigint` to a `uint` is defined as the absolute value truncated to the resultant type. This matches what the underlying gmp routines do, but is confusing for users used to the behavior of `int` to `uint` casts. e.g.:\r\n\r\n\r\n```chpl\r\nuse BigInteger;\r\n\r\nvar regI = -1;\r\nvar bigI = new bigint(-1);\r\n\r\nwriteln(regI:uint(8)); // prints 255\r\nwriteln(bigI:uint(8)); // prints 1\r\n```\r\n\r\nWe could go through extra effort so that the behavior bigint -> uint casts matches int -> uint casts, but we'll probably have to think through the boundary/truncation cases pretty carefully.\r\n\r\nSee the thread in https://github.com/chapel-lang/chapel/pull/10272 for more info "}}
{"actor":{"display_login":"ronawho"}}