{"action":"created","comment":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/35706857","id":35706857,"diff_hunk":"@@ -2664,34 +2760,50 @@ alias FP_ILOGBNAN = core.stdc.math.FP_ILOGBNAN;\n \n @trusted nothrow @nogc unittest\n {\n-    assert(ilogb(real.nan) == FP_ILOGBNAN);\n-    assert(ilogb(-real.nan) == FP_ILOGBNAN);\n-    assert(ilogb(0.0) == FP_ILOGB0);\n-    assert(ilogb(-0.0) == FP_ILOGB0);\n-    assert(ilogb(real.infinity) == int.max);\n-    assert(ilogb(-real.infinity) == int.max);\n-    assert(ilogb(2.0) == 1);\n-    assert(ilogb(2.0001) == 1);\n-    assert(ilogb(1.9999) == 0);\n-    assert(ilogb(0.5) == -1);\n-    assert(ilogb(123.123) == 6);\n-    assert(ilogb(-123.123) == 6);\n-    assert(ilogb(0.123) == -4);\n-    assert(ilogb(-double.min_normal) == -1022);\n+    import std.typetuple, std.typecons;\n+    foreach (F; TypeTuple!(float, double, real))\n+    {\n+        Tuple!(F, int)[] vals =     // x, ilogb(x)\n+        [\n+            tuple(  F.nan     , FP_ILOGBNAN ),\n+            tuple( -F.nan     , FP_ILOGBNAN ),\n+            tuple(  0.0       , FP_ILOGB0   ),\n+            tuple( -0.0       , FP_ILOGB0   ),\n+            tuple(  F.infinity, int.max     ),\n+            tuple( -F.infinity, int.max     ),\n+            tuple(  2.0       , 1           ),\n+            tuple(  2.0001    , 1           ),\n+            tuple(  1.9999    , 0           ),","path":"std/math.d","position":267,"original_position":267,"commit_id":"ec2b77c92ba02e2ccdb2ba336cd7fd9223570dbe","original_commit_id":"ec2b77c92ba02e2ccdb2ba336cd7fd9223570dbe","user":{"login":"9il","id":845083,"avatar_url":"https://avatars.githubusercontent.com/u/845083?v=3","gravatar_id":"","url":"https://api.github.com/users/9il","html_url":"https://github.com/9il","followers_url":"https://api.github.com/users/9il/followers","following_url":"https://api.github.com/users/9il/following{/other_user}","gists_url":"https://api.github.com/users/9il/gists{/gist_id}","starred_url":"https://api.github.com/users/9il/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/9il/subscriptions","organizations_url":"https://api.github.com/users/9il/orgs","repos_url":"https://api.github.com/users/9il/repos","events_url":"https://api.github.com/users/9il/events{/privacy}","received_events_url":"https://api.github.com/users/9il/received_events","type":"User","site_admin":false},"body":"To fix auto test failure use construction like `F(1.9999)` instead","created_at":"2015-07-28T21:59:23Z","updated_at":"2015-07-28T21:59:23Z","html_url":"https://github.com/D-Programming-Language/phobos/pull/3186#discussion_r35706857","pull_request_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3186","_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/comments/35706857"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/3186#discussion_r35706857"},"pull_request":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3186"}}},"pull_request":{"url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3186","id":33127231,"html_url":"https://github.com/D-Programming-Language/phobos/pull/3186","diff_url":"https://github.com/D-Programming-Language/phobos/pull/3186.diff","patch_url":"https://github.com/D-Programming-Language/phobos/pull/3186.patch","issue_url":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3186","number":3186,"state":"open","locked":false,"title":"Add a D implementation for std.math.ilogb","user":{"login":"JohanEngelen","id":10983051,"avatar_url":"https://avatars.githubusercontent.com/u/10983051?v=3","gravatar_id":"","url":"https://api.github.com/users/JohanEngelen","html_url":"https://github.com/JohanEngelen","followers_url":"https://api.github.com/users/JohanEngelen/followers","following_url":"https://api.github.com/users/JohanEngelen/following{/other_user}","gists_url":"https://api.github.com/users/JohanEngelen/gists{/gist_id}","starred_url":"https://api.github.com/users/JohanEngelen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohanEngelen/subscriptions","organizations_url":"https://api.github.com/users/JohanEngelen/orgs","repos_url":"https://api.github.com/users/JohanEngelen/repos","events_url":"https://api.github.com/users/JohanEngelen/events{/privacy}","received_events_url":"https://api.github.com/users/JohanEngelen/received_events","type":"User","site_admin":false},"body":"The reasons for this PR:\r\n- Gets rid of assembly code that is DMD-specific and does not work for LDC. Special case for Windows CRT is no longer needed.\r\n- Avoiding the x87 FPU means this implementation is faster than the assembly code.\r\n- Not calling C-runtime: ilogb can be inlined and the compiler can reason about it.\r\n- Templated so it runs faster for floats and doubles\r\n\r\nSome quick benchmarking showed that it is indeed quite a bit faster, especially (not surprising) for float and double. But the first reason is my main motivation.\r\n\r\nI do not know how to do the casts to enable CTFE.\r\nI added a few extra unittests to increase code coverage.\r\n\r\n(edit: removed wrong comment about ARM)","created_at":"2015-04-12T21:53:03Z","updated_at":"2015-07-28T21:59:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b78d75ec4f5011c2a797e9a973c6fa06e752845d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3186/commits","review_comments_url":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3186/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/3186/comments","statuses_url":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/ec2b77c92ba02e2ccdb2ba336cd7fd9223570dbe","head":{"label":"JohanEngelen:new_ilogb","ref":"new_ilogb","sha":"ec2b77c92ba02e2ccdb2ba336cd7fd9223570dbe","user":{"login":"JohanEngelen","id":10983051,"avatar_url":"https://avatars.githubusercontent.com/u/10983051?v=3","gravatar_id":"","url":"https://api.github.com/users/JohanEngelen","html_url":"https://github.com/JohanEngelen","followers_url":"https://api.github.com/users/JohanEngelen/followers","following_url":"https://api.github.com/users/JohanEngelen/following{/other_user}","gists_url":"https://api.github.com/users/JohanEngelen/gists{/gist_id}","starred_url":"https://api.github.com/users/JohanEngelen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohanEngelen/subscriptions","organizations_url":"https://api.github.com/users/JohanEngelen/orgs","repos_url":"https://api.github.com/users/JohanEngelen/repos","events_url":"https://api.github.com/users/JohanEngelen/events{/privacy}","received_events_url":"https://api.github.com/users/JohanEngelen/received_events","type":"User","site_admin":false},"repo":{"id":31853379,"name":"phobos","full_name":"JohanEngelen/phobos","owner":{"login":"JohanEngelen","id":10983051,"avatar_url":"https://avatars.githubusercontent.com/u/10983051?v=3","gravatar_id":"","url":"https://api.github.com/users/JohanEngelen","html_url":"https://github.com/JohanEngelen","followers_url":"https://api.github.com/users/JohanEngelen/followers","following_url":"https://api.github.com/users/JohanEngelen/following{/other_user}","gists_url":"https://api.github.com/users/JohanEngelen/gists{/gist_id}","starred_url":"https://api.github.com/users/JohanEngelen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JohanEngelen/subscriptions","organizations_url":"https://api.github.com/users/JohanEngelen/orgs","repos_url":"https://api.github.com/users/JohanEngelen/repos","events_url":"https://api.github.com/users/JohanEngelen/events{/privacy}","received_events_url":"https://api.github.com/users/JohanEngelen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JohanEngelen/phobos","description":"The standard library of the D programming language","fork":true,"url":"https://api.github.com/repos/JohanEngelen/phobos","forks_url":"https://api.github.com/repos/JohanEngelen/phobos/forks","keys_url":"https://api.github.com/repos/JohanEngelen/phobos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JohanEngelen/phobos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JohanEngelen/phobos/teams","hooks_url":"https://api.github.com/repos/JohanEngelen/phobos/hooks","issue_events_url":"https://api.github.com/repos/JohanEngelen/phobos/issues/events{/number}","events_url":"https://api.github.com/repos/JohanEngelen/phobos/events","assignees_url":"https://api.github.com/repos/JohanEngelen/phobos/assignees{/user}","branches_url":"https://api.github.com/repos/JohanEngelen/phobos/branches{/branch}","tags_url":"https://api.github.com/repos/JohanEngelen/phobos/tags","blobs_url":"https://api.github.com/repos/JohanEngelen/phobos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JohanEngelen/phobos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JohanEngelen/phobos/git/refs{/sha}","trees_url":"https://api.github.com/repos/JohanEngelen/phobos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JohanEngelen/phobos/statuses/{sha}","languages_url":"https://api.github.com/repos/JohanEngelen/phobos/languages","stargazers_url":"https://api.github.com/repos/JohanEngelen/phobos/stargazers","contributors_url":"https://api.github.com/repos/JohanEngelen/phobos/contributors","subscribers_url":"https://api.github.com/repos/JohanEngelen/phobos/subscribers","subscription_url":"https://api.github.com/repos/JohanEngelen/phobos/subscription","commits_url":"https://api.github.com/repos/JohanEngelen/phobos/commits{/sha}","git_commits_url":"https://api.github.com/repos/JohanEngelen/phobos/git/commits{/sha}","comments_url":"https://api.github.com/repos/JohanEngelen/phobos/comments{/number}","issue_comment_url":"https://api.github.com/repos/JohanEngelen/phobos/issues/comments{/number}","contents_url":"https://api.github.com/repos/JohanEngelen/phobos/contents/{+path}","compare_url":"https://api.github.com/repos/JohanEngelen/phobos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JohanEngelen/phobos/merges","archive_url":"https://api.github.com/repos/JohanEngelen/phobos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JohanEngelen/phobos/downloads","issues_url":"https://api.github.com/repos/JohanEngelen/phobos/issues{/number}","pulls_url":"https://api.github.com/repos/JohanEngelen/phobos/pulls{/number}","milestones_url":"https://api.github.com/repos/JohanEngelen/phobos/milestones{/number}","notifications_url":"https://api.github.com/repos/JohanEngelen/phobos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JohanEngelen/phobos/labels{/name}","releases_url":"https://api.github.com/repos/JohanEngelen/phobos/releases{/id}","created_at":"2015-03-08T14:51:52Z","updated_at":"2015-03-12T21:56:27Z","pushed_at":"2015-07-28T21:50:03Z","git_url":"git://github.com/JohanEngelen/phobos.git","ssh_url":"git@github.com:JohanEngelen/phobos.git","clone_url":"https://github.com/JohanEngelen/phobos.git","svn_url":"https://github.com/JohanEngelen/phobos","homepage":"dlang.org/phobos","size":44261,"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":"033cdd8568f9e5ee0b5b2d87bea38d3e85962286","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-07-26T23:19:02Z","pushed_at":"2015-07-28T21:50:04Z","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":88301,"stargazers_count":611,"watchers_count":611,"language":"D","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":411,"mirror_url":null,"open_issues_count":65,"forks":411,"open_issues":65,"watchers":611,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3186"},"html":{"href":"https://github.com/D-Programming-Language/phobos/pull/3186"},"issue":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3186"},"comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/issues/3186/comments"},"review_comments":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/pulls/3186/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/3186/commits"},"statuses":{"href":"https://api.github.com/repos/D-Programming-Language/phobos/statuses/ec2b77c92ba02e2ccdb2ba336cd7fd9223570dbe"}}}}