{"action":"created","comment":{"url":"https://api.github.com/repos/cs50/lib50-cpp/pulls/comments/82114965","pull_request_review_id":3044003,"id":82114965,"diff_hunk":"@@ -76,38 +81,35 @@ double get_double(void)\n  */\n float get_float(void)\n {\n-    // attempt to take a float from the user\n+    // attempt to take a double from the user\n     while (true)\n     {\n         std::string str = get_string();\n \n-        // if eof, failbit or badbit clear state and return FLT_MAX\n-        if (std::cin.eof() || std::cin.fail())\n+        // if eof, failbit or badbit return DOUBLE_MAX\n+        if (str[0] == '\\0')\n         {\n-            std::cin.clear();\n             return FLT_MAX;\n         }\n \n-        // validate input\n-        std::regex re(\"(\\\\+|-)?\\\\d*(\\\\.\\\\d*)?\");\n-\n-        // on matching input attempt to convert string to float\n-        if (std::regex_match(str, re))\n+        // validate input \n+        if(!isspace(str[0])) \n         {\n-            try\n-            {\n-                return std::stof(str);\n-            }\n-            // in case of value exceeding float size do nothing and reprompt\n-            catch (const std::exception&)\n+            char* tail;","path":"src/cs50.cpp","position":null,"original_position":106,"commit_id":"e6b98c8a8db296197594ac39cb62eb1be3a721ec","original_commit_id":"e6b98c8a8db296197594ac39cb62eb1be3a721ec","user":{"login":"dmalan","id":788678,"avatar_url":"https://avatars.githubusercontent.com/u/788678?v=3","gravatar_id":"","url":"https://api.github.com/users/dmalan","html_url":"https://github.com/dmalan","followers_url":"https://api.github.com/users/dmalan/followers","following_url":"https://api.github.com/users/dmalan/following{/other_user}","gists_url":"https://api.github.com/users/dmalan/gists{/gist_id}","starred_url":"https://api.github.com/users/dmalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmalan/subscriptions","organizations_url":"https://api.github.com/users/dmalan/orgs","repos_url":"https://api.github.com/users/dmalan/repos","events_url":"https://api.github.com/users/dmalan/events{/privacy}","received_events_url":"https://api.github.com/users/dmalan/received_events","type":"User","site_admin":false},"body":"`char *tail`","created_at":"2016-10-06T04:17:41Z","updated_at":"2016-10-06T04:21:19Z","html_url":"https://github.com/cs50/lib50-cpp/pull/3#discussion_r82114965","pull_request_url":"https://api.github.com/repos/cs50/lib50-cpp/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/cs50/lib50-cpp/pulls/comments/82114965"},"html":{"href":"https://github.com/cs50/lib50-cpp/pull/3#discussion_r82114965"},"pull_request":{"href":"https://api.github.com/repos/cs50/lib50-cpp/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/cs50/lib50-cpp/pulls/3","id":88024695,"html_url":"https://github.com/cs50/lib50-cpp/pull/3","diff_url":"https://github.com/cs50/lib50-cpp/pull/3.diff","patch_url":"https://github.com/cs50/lib50-cpp/pull/3.patch","issue_url":"https://api.github.com/repos/cs50/lib50-cpp/issues/3","number":3,"state":"open","locked":false,"title":"get_float and get_double added","user":{"login":"irenenaya","id":19484391,"avatar_url":"https://avatars.githubusercontent.com/u/19484391?v=3","gravatar_id":"","url":"https://api.github.com/users/irenenaya","html_url":"https://github.com/irenenaya","followers_url":"https://api.github.com/users/irenenaya/followers","following_url":"https://api.github.com/users/irenenaya/following{/other_user}","gists_url":"https://api.github.com/users/irenenaya/gists{/gist_id}","starred_url":"https://api.github.com/users/irenenaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irenenaya/subscriptions","organizations_url":"https://api.github.com/users/irenenaya/orgs","repos_url":"https://api.github.com/users/irenenaya/repos","events_url":"https://api.github.com/users/irenenaya/events{/privacy}","received_events_url":"https://api.github.com/users/irenenaya/received_events","type":"User","site_admin":false},"body":"Doesn't currently work correctly on the IDE because of issues of gcc with regex. According to the gnu documentation, the earliest version that works correctly is 4.9. Just let me know in case there's any issues because of this. Otherwise, I've tested it and works just as the current version of the c get_float() and get_double()\r\nHope the fork is helpful :)","created_at":"2016-10-05T06:52:34Z","updated_at":"2016-10-06T04:21:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e3b771278188ea1d18047eba69c2babd362694e5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cs50/lib50-cpp/pulls/3/commits","review_comments_url":"https://api.github.com/repos/cs50/lib50-cpp/pulls/3/comments","review_comment_url":"https://api.github.com/repos/cs50/lib50-cpp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cs50/lib50-cpp/issues/3/comments","statuses_url":"https://api.github.com/repos/cs50/lib50-cpp/statuses/e6b98c8a8db296197594ac39cb62eb1be3a721ec","head":{"label":"irenenaya:master","ref":"master","sha":"e6b98c8a8db296197594ac39cb62eb1be3a721ec","user":{"login":"irenenaya","id":19484391,"avatar_url":"https://avatars.githubusercontent.com/u/19484391?v=3","gravatar_id":"","url":"https://api.github.com/users/irenenaya","html_url":"https://github.com/irenenaya","followers_url":"https://api.github.com/users/irenenaya/followers","following_url":"https://api.github.com/users/irenenaya/following{/other_user}","gists_url":"https://api.github.com/users/irenenaya/gists{/gist_id}","starred_url":"https://api.github.com/users/irenenaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irenenaya/subscriptions","organizations_url":"https://api.github.com/users/irenenaya/orgs","repos_url":"https://api.github.com/users/irenenaya/repos","events_url":"https://api.github.com/users/irenenaya/events{/privacy}","received_events_url":"https://api.github.com/users/irenenaya/received_events","type":"User","site_admin":false},"repo":{"id":70008456,"name":"lib50-cpp","full_name":"irenenaya/lib50-cpp","owner":{"login":"irenenaya","id":19484391,"avatar_url":"https://avatars.githubusercontent.com/u/19484391?v=3","gravatar_id":"","url":"https://api.github.com/users/irenenaya","html_url":"https://github.com/irenenaya","followers_url":"https://api.github.com/users/irenenaya/followers","following_url":"https://api.github.com/users/irenenaya/following{/other_user}","gists_url":"https://api.github.com/users/irenenaya/gists{/gist_id}","starred_url":"https://api.github.com/users/irenenaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/irenenaya/subscriptions","organizations_url":"https://api.github.com/users/irenenaya/orgs","repos_url":"https://api.github.com/users/irenenaya/repos","events_url":"https://api.github.com/users/irenenaya/events{/privacy}","received_events_url":"https://api.github.com/users/irenenaya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/irenenaya/lib50-cpp","description":"This is CS50's library for C++.","fork":true,"url":"https://api.github.com/repos/irenenaya/lib50-cpp","forks_url":"https://api.github.com/repos/irenenaya/lib50-cpp/forks","keys_url":"https://api.github.com/repos/irenenaya/lib50-cpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/irenenaya/lib50-cpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/irenenaya/lib50-cpp/teams","hooks_url":"https://api.github.com/repos/irenenaya/lib50-cpp/hooks","issue_events_url":"https://api.github.com/repos/irenenaya/lib50-cpp/issues/events{/number}","events_url":"https://api.github.com/repos/irenenaya/lib50-cpp/events","assignees_url":"https://api.github.com/repos/irenenaya/lib50-cpp/assignees{/user}","branches_url":"https://api.github.com/repos/irenenaya/lib50-cpp/branches{/branch}","tags_url":"https://api.github.com/repos/irenenaya/lib50-cpp/tags","blobs_url":"https://api.github.com/repos/irenenaya/lib50-cpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/irenenaya/lib50-cpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/irenenaya/lib50-cpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/irenenaya/lib50-cpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/irenenaya/lib50-cpp/statuses/{sha}","languages_url":"https://api.github.com/repos/irenenaya/lib50-cpp/languages","stargazers_url":"https://api.github.com/repos/irenenaya/lib50-cpp/stargazers","contributors_url":"https://api.github.com/repos/irenenaya/lib50-cpp/contributors","subscribers_url":"https://api.github.com/repos/irenenaya/lib50-cpp/subscribers","subscription_url":"https://api.github.com/repos/irenenaya/lib50-cpp/subscription","commits_url":"https://api.github.com/repos/irenenaya/lib50-cpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/irenenaya/lib50-cpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/irenenaya/lib50-cpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/irenenaya/lib50-cpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/irenenaya/lib50-cpp/contents/{+path}","compare_url":"https://api.github.com/repos/irenenaya/lib50-cpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/irenenaya/lib50-cpp/merges","archive_url":"https://api.github.com/repos/irenenaya/lib50-cpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/irenenaya/lib50-cpp/downloads","issues_url":"https://api.github.com/repos/irenenaya/lib50-cpp/issues{/number}","pulls_url":"https://api.github.com/repos/irenenaya/lib50-cpp/pulls{/number}","milestones_url":"https://api.github.com/repos/irenenaya/lib50-cpp/milestones{/number}","notifications_url":"https://api.github.com/repos/irenenaya/lib50-cpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/irenenaya/lib50-cpp/labels{/name}","releases_url":"https://api.github.com/repos/irenenaya/lib50-cpp/releases{/id}","deployments_url":"https://api.github.com/repos/irenenaya/lib50-cpp/deployments","created_at":"2016-10-04T21:36:54Z","updated_at":"2016-10-04T21:36:54Z","pushed_at":"2016-10-06T04:13:33Z","git_url":"git://github.com/irenenaya/lib50-cpp.git","ssh_url":"git@github.com:irenenaya/lib50-cpp.git","clone_url":"https://github.com/irenenaya/lib50-cpp.git","svn_url":"https://github.com/irenenaya/lib50-cpp","homepage":"https://cs50.harvard.edu/","size":4,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"cs50:master","ref":"master","sha":"bfc39c90f9e9fb1f0544a4ce183a33d86d69ca59","user":{"login":"cs50","id":788676,"avatar_url":"https://avatars.githubusercontent.com/u/788676?v=3","gravatar_id":"","url":"https://api.github.com/users/cs50","html_url":"https://github.com/cs50","followers_url":"https://api.github.com/users/cs50/followers","following_url":"https://api.github.com/users/cs50/following{/other_user}","gists_url":"https://api.github.com/users/cs50/gists{/gist_id}","starred_url":"https://api.github.com/users/cs50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs50/subscriptions","organizations_url":"https://api.github.com/users/cs50/orgs","repos_url":"https://api.github.com/users/cs50/repos","events_url":"https://api.github.com/users/cs50/events{/privacy}","received_events_url":"https://api.github.com/users/cs50/received_events","type":"Organization","site_admin":false},"repo":{"id":69903183,"name":"lib50-cpp","full_name":"cs50/lib50-cpp","owner":{"login":"cs50","id":788676,"avatar_url":"https://avatars.githubusercontent.com/u/788676?v=3","gravatar_id":"","url":"https://api.github.com/users/cs50","html_url":"https://github.com/cs50","followers_url":"https://api.github.com/users/cs50/followers","following_url":"https://api.github.com/users/cs50/following{/other_user}","gists_url":"https://api.github.com/users/cs50/gists{/gist_id}","starred_url":"https://api.github.com/users/cs50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cs50/subscriptions","organizations_url":"https://api.github.com/users/cs50/orgs","repos_url":"https://api.github.com/users/cs50/repos","events_url":"https://api.github.com/users/cs50/events{/privacy}","received_events_url":"https://api.github.com/users/cs50/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cs50/lib50-cpp","description":"This is CS50's library for C++.","fork":false,"url":"https://api.github.com/repos/cs50/lib50-cpp","forks_url":"https://api.github.com/repos/cs50/lib50-cpp/forks","keys_url":"https://api.github.com/repos/cs50/lib50-cpp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cs50/lib50-cpp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cs50/lib50-cpp/teams","hooks_url":"https://api.github.com/repos/cs50/lib50-cpp/hooks","issue_events_url":"https://api.github.com/repos/cs50/lib50-cpp/issues/events{/number}","events_url":"https://api.github.com/repos/cs50/lib50-cpp/events","assignees_url":"https://api.github.com/repos/cs50/lib50-cpp/assignees{/user}","branches_url":"https://api.github.com/repos/cs50/lib50-cpp/branches{/branch}","tags_url":"https://api.github.com/repos/cs50/lib50-cpp/tags","blobs_url":"https://api.github.com/repos/cs50/lib50-cpp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cs50/lib50-cpp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cs50/lib50-cpp/git/refs{/sha}","trees_url":"https://api.github.com/repos/cs50/lib50-cpp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cs50/lib50-cpp/statuses/{sha}","languages_url":"https://api.github.com/repos/cs50/lib50-cpp/languages","stargazers_url":"https://api.github.com/repos/cs50/lib50-cpp/stargazers","contributors_url":"https://api.github.com/repos/cs50/lib50-cpp/contributors","subscribers_url":"https://api.github.com/repos/cs50/lib50-cpp/subscribers","subscription_url":"https://api.github.com/repos/cs50/lib50-cpp/subscription","commits_url":"https://api.github.com/repos/cs50/lib50-cpp/commits{/sha}","git_commits_url":"https://api.github.com/repos/cs50/lib50-cpp/git/commits{/sha}","comments_url":"https://api.github.com/repos/cs50/lib50-cpp/comments{/number}","issue_comment_url":"https://api.github.com/repos/cs50/lib50-cpp/issues/comments{/number}","contents_url":"https://api.github.com/repos/cs50/lib50-cpp/contents/{+path}","compare_url":"https://api.github.com/repos/cs50/lib50-cpp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cs50/lib50-cpp/merges","archive_url":"https://api.github.com/repos/cs50/lib50-cpp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cs50/lib50-cpp/downloads","issues_url":"https://api.github.com/repos/cs50/lib50-cpp/issues{/number}","pulls_url":"https://api.github.com/repos/cs50/lib50-cpp/pulls{/number}","milestones_url":"https://api.github.com/repos/cs50/lib50-cpp/milestones{/number}","notifications_url":"https://api.github.com/repos/cs50/lib50-cpp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cs50/lib50-cpp/labels{/name}","releases_url":"https://api.github.com/repos/cs50/lib50-cpp/releases{/id}","deployments_url":"https://api.github.com/repos/cs50/lib50-cpp/deployments","created_at":"2016-10-03T19:25:19Z","updated_at":"2016-10-03T20:01:38Z","pushed_at":"2016-10-06T04:13:34Z","git_url":"git://github.com/cs50/lib50-cpp.git","ssh_url":"git@github.com:cs50/lib50-cpp.git","clone_url":"https://github.com/cs50/lib50-cpp.git","svn_url":"https://github.com/cs50/lib50-cpp","homepage":"https://cs50.harvard.edu/","size":1,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cs50/lib50-cpp/pulls/3"},"html":{"href":"https://github.com/cs50/lib50-cpp/pull/3"},"issue":{"href":"https://api.github.com/repos/cs50/lib50-cpp/issues/3"},"comments":{"href":"https://api.github.com/repos/cs50/lib50-cpp/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/cs50/lib50-cpp/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/cs50/lib50-cpp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cs50/lib50-cpp/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/cs50/lib50-cpp/statuses/e6b98c8a8db296197594ac39cb62eb1be3a721ec"}}}}
{"actor":{"display_login":"dmalan"}}