{"action":"created","issue":{"url":"https://api.github.com/repos/dlang/phobos/issues/4337","repository_url":"https://api.github.com/repos/dlang/phobos","labels_url":"https://api.github.com/repos/dlang/phobos/issues/4337/labels{/name}","comments_url":"https://api.github.com/repos/dlang/phobos/issues/4337/comments","events_url":"https://api.github.com/repos/dlang/phobos/issues/4337/events","html_url":"https://github.com/dlang/phobos/pull/4337","id":155471077,"number":4337,"title":"Fix issue 16026: std.math.frexp!float() wrong for very small subnormals","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},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-18T10:47:46Z","updated_at":"2016-05-18T10:47:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dlang/phobos/pulls/4337","html_url":"https://github.com/dlang/phobos/pull/4337","diff_url":"https://github.com/dlang/phobos/pull/4337.diff","patch_url":"https://github.com/dlang/phobos/pull/4337.patch"},"body":"This PR fixes [Phobos issue #16026](https://issues.dlang.org/show_bug.cgi?id=16026): `std.math.frexp!float()` and `std.math.frexp!double()` return a wrong significand for subnormal values.\r\n\r\nThe problem turns out to be a wrong \"*magic number*\" `0x8000` which selects which values of the highest 16 bits should be preserved while manually changing the exponent using bitwise operations. The correct value is `~F.EXPMASK`, which happens to equal `0x8000` for the 80-bit and 128-bit IEEE formats, but not for 32- or 64-bit.\r\n\r\n(Ultimately, I intend to replace the entire `frexp()` implementation with a clearer and more concise one based on [`RealRep`](https://github.com/dlang/phobos/pull/4336), but I realize that it may take a while to get such a large change pulled, so I thought I'd submit this quick fix in the mean time.)"},"comment":{"url":"https://api.github.com/repos/dlang/phobos/issues/comments/219990885","html_url":"https://github.com/dlang/phobos/pull/4337#issuecomment-219990885","issue_url":"https://api.github.com/repos/dlang/phobos/issues/4337","id":219990885,"user":{"login":"dlang-bot","id":15698993,"avatar_url":"https://avatars.githubusercontent.com/u/15698993?v=3","gravatar_id":"","url":"https://api.github.com/users/dlang-bot","html_url":"https://github.com/dlang-bot","followers_url":"https://api.github.com/users/dlang-bot/followers","following_url":"https://api.github.com/users/dlang-bot/following{/other_user}","gists_url":"https://api.github.com/users/dlang-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/dlang-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlang-bot/subscriptions","organizations_url":"https://api.github.com/users/dlang-bot/orgs","repos_url":"https://api.github.com/users/dlang-bot/repos","events_url":"https://api.github.com/users/dlang-bot/events{/privacy}","received_events_url":"https://api.github.com/users/dlang-bot/received_events","type":"User","site_admin":false},"created_at":"2016-05-18T10:47:48Z","updated_at":"2016-05-18T10:47:48Z","body":"Fix | Bugzilla | Description\n--- | --- | ---\n✓ | [16026](https://issues.dlang.org/show_bug.cgi?id=16026) | std.math.frexp!float() wrong for very small subnormal values\n"}}