{"action":"created","issue":{"url":"https://api.github.com/repos/briandfoy/excellent_numbers/issues/14","repository_url":"https://api.github.com/repos/briandfoy/excellent_numbers","labels_url":"https://api.github.com/repos/briandfoy/excellent_numbers/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/briandfoy/excellent_numbers/issues/14/comments","events_url":"https://api.github.com/repos/briandfoy/excellent_numbers/issues/14/events","html_url":"https://github.com/briandfoy/excellent_numbers/issues/14","id":138792671,"number":14,"title":"Missing 32 digit numbers with excellent-128","user":{"login":"nanis","id":288163,"avatar_url":"https://avatars.githubusercontent.com/u/288163?v=3","gravatar_id":"","url":"https://api.github.com/users/nanis","html_url":"https://github.com/nanis","followers_url":"https://api.github.com/users/nanis/followers","following_url":"https://api.github.com/users/nanis/following{/other_user}","gists_url":"https://api.github.com/users/nanis/gists{/gist_id}","starred_url":"https://api.github.com/users/nanis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nanis/subscriptions","organizations_url":"https://api.github.com/users/nanis/orgs","repos_url":"https://api.github.com/users/nanis/repos","events_url":"https://api.github.com/users/nanis/events{/privacy}","received_events_url":"https://api.github.com/users/nanis/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-06T13:58:42Z","updated_at":"2016-03-06T17:16:30Z","closed_at":null,"body":"A 16 digit integer requires 53.151 bits whereas a 64-bit provides a 53-bit significand. This causes inaccuracies in the `double` `sqrt`. As a result, this program fails to identify some 32 digit excellent numbers.\r\n\r\nNote that using the [paraphrased estimation of `b`](https://github.com/briandfoy/excellent_numbers/blob/6a6b7b510bbcbac2fb165bbf75a0b75bcb55750f/c/excellent-128.c#L430), the number of excellent numbers missed is reduced, but the program still misses more than twenty 32-digit excellent numbers.\r\n\r\nI [had mentioned this possibility](https://www.nu42.com/2016/01/excellent-optimization-story.html) and mentioned in passing that we could switch to using 80-bit `long double`s.\r\n\r\nSwitching to using `long double` `sqrtl` now catches all the 32-digit numbers which the program missed, but at a significant speed penalty when compiled with Cygwin's gcc on Windows (I haven't tested elsewhere yet). That is presumably because `double`s get to use SSEx whereas `long double`s switch to using `x87`.\r\n\r\n**Using `long double`s, searching for 22-digit excellent numbers takes about 15 minutes.** That is up from about 3 minutes.\r\n\r\n- [ ] Verify speed penalty on Linux on decent hardware\r\n- [ ] Is gcc's [`libquadmath`](https://gcc.gnu.org/onlinedocs/libquadmath/) (128 bit floats) better?\r\n\r\nI also tried looking around the estimate of `b`. That did not seem to catch everything either, and I did not check for false positives. Worth investigating."},"comment":{"url":"https://api.github.com/repos/briandfoy/excellent_numbers/issues/comments/192937991","html_url":"https://github.com/briandfoy/excellent_numbers/issues/14#issuecomment-192937991","issue_url":"https://api.github.com/repos/briandfoy/excellent_numbers/issues/14","id":192937991,"user":{"login":"nanis","id":288163,"avatar_url":"https://avatars.githubusercontent.com/u/288163?v=3","gravatar_id":"","url":"https://api.github.com/users/nanis","html_url":"https://github.com/nanis","followers_url":"https://api.github.com/users/nanis/followers","following_url":"https://api.github.com/users/nanis/following{/other_user}","gists_url":"https://api.github.com/users/nanis/gists{/gist_id}","starred_url":"https://api.github.com/users/nanis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nanis/subscriptions","organizations_url":"https://api.github.com/users/nanis/orgs","repos_url":"https://api.github.com/users/nanis/repos","events_url":"https://api.github.com/users/nanis/events{/privacy}","received_events_url":"https://api.github.com/users/nanis/received_events","type":"User","site_admin":false},"created_at":"2016-03-06T17:16:30Z","updated_at":"2016-03-06T17:16:30Z","body":"Using `__float128` from libquadmath is even slower."}}