{"action":"closed","number":3598,"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3598","id":43687403,"html_url":"https://github.com/D-Programming-Language/phobos/pull/3598","diff_url":"https://github.com/D-Programming-Language/phobos/pull/3598.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/3598.patch","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3598","number":3598,"state":"closed","locked":false,"title":"Fix Issue 14786 -  std.math.pow sometimes gets the sign of the result wrong.","user":{"login":"tsbockman","id":1332026,"avatar_url":"https://avatars.githubusercontent.com/u/1332026?v=3","gravatar_id":"","url":"https://api.github.com/users/tsbockman","html_url":"https://github.com/tsbockman","followers_url":"https://api.github.com/users/tsbockman/followers","following_url":"https://api.github.com/users/tsbockman/following{/other_user}","gists_url":"https://api.github.com/users/tsbockman/gists{/gist_id}","starred_url":"https://api.github.com/users/tsbockman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsbockman/subscriptions","organizations_url":"https://api.github.com/users/tsbockman/orgs","repos_url":"https://api.github.com/users/tsbockman/repos","events_url":"https://api.github.com/users/tsbockman/events{/privacy}","received_events_url":"https://api.github.com/users/tsbockman/received_events","type":"User","site_admin":false},"body":"This is a simple fix for Phobos [Issue #14786](https://issues.dlang.org/show_bug.cgi?id=14786).\r\n\r\nNegative one raised to any odd power should yield negative one.\r\n\r\nHowever, when using 80-bit real arithmetic, -1 raised to a power greater than 2^^63 and less than 2^^64 yields +1.\r\n\r\nThis is despite the fact that integers in this range can still (just barely) be represented without loss of precision by an 80-bit real; even and odd can still be distinguished.\r\n\r\n```D\r\n/** Test cases that fails without this PR **/\r\nvoid main(string[] args)\r\n{\r\n    real b = -1;\r\n    real e = long.max;\r\n    e += 2;\r\n    assert(e % 2 == 1);\r\n    real r = b ^^ e;\r\n    assert(r == 1);  // Passes, but shouldn't\r\n    assert(r == -1); // Fails, but shouldn't\r\n\r\n    e = ulong.max;\r\n    assert(e % 2 == 1);\r\n    r = b ^^ e;\r\n    assert(r == 1);  // Passes, but shouldn't\r\n    assert(r == -1); // Fails, but shouldn't\r\n}\r\n```\r\n\r\nThanks to @ibuclaw for pointing me to the relevant code.","created_at":"2015-08-29T02:59:05Z","updated_at":"2015-12-06T08:50:06Z","closed_at":"2015-12-06T08:50:06Z","merged_at":"2015-12-06T08:50:06Z","merge_commit_sha":"749067cc5dd82436d35dbd955b744e6c3720ce77","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3598/commits","review_comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3598/comments","review_comment_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3598/comments","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/4b690ef72fc61e7cdd4f75dcb11ed328fbed31e7","head":{"label":"tsbockman:issue_14786","ref":"issue_14786","sha":"4b690ef72fc61e7cdd4f75dcb11ed328fbed31e7","user":{"login":"tsbockman","id":1332026,"avatar_url":"https://avatars.githubusercontent.com/u/1332026?v=3","gravatar_id":"","url":"https://api.github.com/users/tsbockman","html_url":"https://github.com/tsbockman","followers_url":"https://api.github.com/users/tsbockman/followers","following_url":"https://api.github.com/users/tsbockman/following{/other_user}","gists_url":"https://api.github.com/users/tsbockman/gists{/gist_id}","starred_url":"https://api.github.com/users/tsbockman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsbockman/subscriptions","organizations_url":"https://api.github.com/users/tsbockman/orgs","repos_url":"https://api.github.com/users/tsbockman/repos","events_url":"https://api.github.com/users/tsbockman/events{/privacy}","received_events_url":"https://api.github.com/users/tsbockman/received_events","type":"User","site_admin":false},"repo":{"id":41576397,"name":"phobos","full_name":"tsbockman/phobos","owner":{"login":"tsbockman","id":1332026,"avatar_url":"https://avatars.githubusercontent.com/u/1332026?v=3","gravatar_id":"","url":"https://api.github.com/users/tsbockman","html_url":"https://github.com/tsbockman","followers_url":"https://api.github.com/users/tsbockman/followers","following_url":"https://api.github.com/users/tsbockman/following{/other_user}","gists_url":"https://api.github.com/users/tsbockman/gists{/gist_id}","starred_url":"https://api.github.com/users/tsbockman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsbockman/subscriptions","organizations_url":"https://api.github.com/users/tsbockman/orgs","repos_url":"https://api.github.com/users/tsbockman/repos","events_url":"https://api.github.com/users/tsbockman/events{/privacy}","received_events_url":"https://api.github.com/users/tsbockman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tsbockman/phobos","description":"The standard library of the D programming language","fork":true,"url":"https://api.github.com/repos/tsbockman/phobos","forks_url":"https://api.github.com/repos/tsbockman/phobos/forks","keys_url":"https://api.github.com/repos/tsbockman/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tsbockman/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tsbockman/phobos/teams","hooks_url":"https://api.github.com/repos/tsbockman/phobos/hooks","issue_events_url":"https://api.github.com/repos/tsbockman/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/tsbockman/phobos/events","assignees_url":"https://api.github.com/repos/tsbockman/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/tsbockman/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/tsbockman/phobos/tags","blobs_url":"https://api.github.com/repos/tsbockman/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tsbockman/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tsbockman/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/tsbockman/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tsbockman/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/tsbockman/phobos/languages","stargazers_url":"https://api.github.com/repos/tsbockman/phobos/stargazers","contributors_url":"https://api.github.com/repos/tsbockman/phobos/contributors","subscribers_url":"https://api.github.com/repos/tsbockman/phobos/subscribers","subscription_url":"https://api.github.com/repos/tsbockman/phobos/subscription","commits_url":"https://api.github.com/repos/tsbockman/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/tsbockman/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/tsbockman/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/tsbockman/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/tsbockman/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/tsbockman/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tsbockman/phobos/merges","archive_url":"https://api.github.com/repos/tsbockman/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tsbockman/phobos/downloads","issues_url":"https://api.github.com/repos/tsbockman/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/tsbockman/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/tsbockman/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/tsbockman/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tsbockman/phobos/labels{/name}","releases_url":"https://api.github.com/repos/tsbockman/phobos/releases{/id}","created_at":"2015-08-29T01:34:00Z","updated_at":"2015-08-29T01:34:02Z","pushed_at":"2015-12-05T23:41:32Z","git_url":"git://github.com/tsbockman/phobos.git","ssh_url":"git@github.com:tsbockman/phobos.git","clone_url":"https://github.com/tsbockman/phobos.git","svn_url":"https://github.com/tsbockman/phobos","homepage":"dlang.org/phobos","size":47073,"stargazers_count":0,"watchers_count":0,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"D-Programming-Language:master","ref":"master","sha":"0c39d2d341eac3f3c81f6608dedd25ee2689d576","user":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"repo":{"id":1257084,"name":"phobos","full_name":"D-Programming-Language/phobos","owner":{"login":"D-Programming-Language","id":565913,"avatar_url":"https://avatars.githubusercontent.com/u/565913?v=3","gravatar_id":"","url":"https://api.github.com/users/D-Programming-Language","html_url":"https://github.com/D-Programming-Language","followers_url":"https://api.github.com/users/D-Programming-Language/followers","following_url":"https://api.github.com/users/D-Programming-Language/following{/other_user}","gists_url":"https://api.github.com/users/D-Programming-Language/gists{/gist_id}","starred_url":"https://api.github.com/users/D-Programming-Language/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/D-Programming-Language/subscriptions","organizations_url":"https://api.github.com/users/D-Programming-Language/orgs","repos_url":"https://api.github.com/users/D-Programming-Language/repos","events_url":"https://api.github.com/users/D-Programming-Language/events{/privacy}","received_events_url":"https://api.github.com/users/D-Programming-Language/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/D-Programming-Language/phobos","description":"The standard library of the D programming language","fork":false,"url":"https://api.github.com/repos/D-Programming-Language/phobos","forks_url":"https://api.github.com/repos/D-Programming-Language/phobos/forks","keys_url":"https://api.github.com/repos/D-Programming-Language/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/D-Programming-Language/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/D-Programming-Language/phobos/teams","hooks_url":"https://api.github.com/repos/D-Programming-Language/phobos/hooks","issue_events_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/D-Programming-Language/phobos/events","assignees_url":"https://api.github.com/repos/D-Programming-Language/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/D-Programming-Language/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/D-Programming-Language/phobos/tags","blobs_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/D-Programming-Language/phobos/languages","stargazers_url":"https://api.github.com/repos/D-Programming-Language/phobos/stargazers","contributors_url":"https://api.github.com/repos/D-Programming-Language/phobos/contributors","subscribers_url":"https://api.github.com/repos/D-Programming-Language/phobos/subscribers","subscription_url":"https://api.github.com/repos/D-Programming-Language/phobos/subscription","commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/D-Programming-Language/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/D-Programming-Language/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/D-Programming-Language/phobos/merges","archive_url":"https://api.github.com/repos/D-Programming-Language/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/D-Programming-Language/phobos/downloads","issues_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/D-Programming-Language/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/D-Programming-Language/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/D-Programming-Language/phobos/labels{/name}","releases_url":"https://api.github.com/repos/D-Programming-Language/phobos/releases{/id}","created_at":"2011-01-15T07:00:06Z","updated_at":"2015-12-02T21:31:53Z","pushed_at":"2015-12-06T08:50:06Z","git_url":"git://github.com/D-Programming-Language/phobos.git","ssh_url":"git@github.com:D-Programming-Language/phobos.git","clone_url":"https://github.com/D-Programming-Language/phobos.git","svn_url":"https://github.com/D-Programming-Language/phobos","homepage":"dlang.org/phobos","size":67954,"stargazers_count":652,"watchers_count":652,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":434,"mirror_url":null,"open_issues_count":73,"forks":434,"open_issues":73,"watchers":652,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3598"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/3598"},"issue":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3598"},"comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3598/comments"},"review_comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3598/comments"},"review_comment":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3598/commits"},"statuses":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/4b690ef72fc61e7cdd4f75dcb11ed328fbed31e7"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"ibuclaw","id":397929,"avatar_url":"https://avatars.githubusercontent.com/u/397929?v=3","gravatar_id":"","url":"https://api.github.com/users/ibuclaw","html_url":"https://github.com/ibuclaw","followers_url":"https://api.github.com/users/ibuclaw/followers","following_url":"https://api.github.com/users/ibuclaw/following{/other_user}","gists_url":"https://api.github.com/users/ibuclaw/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuclaw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuclaw/subscriptions","organizations_url":"https://api.github.com/users/ibuclaw/orgs","repos_url":"https://api.github.com/users/ibuclaw/repos","events_url":"https://api.github.com/users/ibuclaw/events{/privacy}","received_events_url":"https://api.github.com/users/ibuclaw/received_events","type":"User","site_admin":false},"comments":38,"review_comments":6,"commits":4,"additions":31,"deletions":4,"changed_files":1}}