{"action":"created","issue":{"url":"https://api.github.com/repos/nlohmann/json/issues/183","labels_url":"https://api.github.com/repos/nlohmann/json/issues/183/labels{/name}","comments_url":"https://api.github.com/repos/nlohmann/json/issues/183/comments","events_url":"https://api.github.com/repos/nlohmann/json/issues/183/events","html_url":"https://github.com/nlohmann/json/pull/183","id":127088577,"number":183,"title":"Extending support to full uint64_t/int64_t range - issue #178 (Integer conversion to unsigned)","user":{"login":"twelsby","id":16697318,"avatar_url":"https://avatars.githubusercontent.com/u/16697318?v=3","gravatar_id":"","url":"https://api.github.com/users/twelsby","html_url":"https://github.com/twelsby","followers_url":"https://api.github.com/users/twelsby/followers","following_url":"https://api.github.com/users/twelsby/following{/other_user}","gists_url":"https://api.github.com/users/twelsby/gists{/gist_id}","starred_url":"https://api.github.com/users/twelsby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twelsby/subscriptions","organizations_url":"https://api.github.com/users/twelsby/orgs","repos_url":"https://api.github.com/users/twelsby/repos","events_url":"https://api.github.com/users/twelsby/events{/privacy}","received_events_url":"https://api.github.com/users/twelsby/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nlohmann/json/labels/enhancement","name":"enhancement","color":"207de5"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/nlohmann/json/milestones/3","html_url":"https://github.com/nlohmann/json/milestones/Release%202.0.0","labels_url":"https://api.github.com/repos/nlohmann/json/milestones/3/labels","id":1510937,"number":3,"title":"Release 2.0.0","description":"","creator":{"login":"nlohmann","id":159488,"avatar_url":"https://avatars.githubusercontent.com/u/159488?v=3","gravatar_id":"","url":"https://api.github.com/users/nlohmann","html_url":"https://github.com/nlohmann","followers_url":"https://api.github.com/users/nlohmann/followers","following_url":"https://api.github.com/users/nlohmann/following{/other_user}","gists_url":"https://api.github.com/users/nlohmann/gists{/gist_id}","starred_url":"https://api.github.com/users/nlohmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlohmann/subscriptions","organizations_url":"https://api.github.com/users/nlohmann/orgs","repos_url":"https://api.github.com/users/nlohmann/repos","events_url":"https://api.github.com/users/nlohmann/events{/privacy}","received_events_url":"https://api.github.com/users/nlohmann/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2016-01-17T12:14:39Z","updated_at":"2016-01-24T15:34:58Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2016-01-17T11:08:43Z","updated_at":"2016-01-24T15:34:58Z","closed_at":"2016-01-24T15:34:58Z","pull_request":{"url":"https://api.github.com/repos/nlohmann/json/pulls/183","html_url":"https://github.com/nlohmann/json/pull/183","diff_url":"https://github.com/nlohmann/json/pull/183.diff","patch_url":"https://github.com/nlohmann/json/pull/183.patch"},"body":"This pull request is to address issues raised in issue #178 related to the use of `uint64_t` and `int64_t` types and the inaccuracies involved in parsing, or creating objects with the full range of these values.  Specifically it addresses the following problems:\r\n\r\n1. Creating an object with a `uint64_t` value greater than (2<sup>63</sup>) -1 will cause it to be represented as an incorrect negative value internally, and subsequently serialized as the negative value.\r\n2. Numbers are parsed as a `double` initially and then converted to integers if possible, so parsing a number greater than (2<sup>53</sup>) - 1 or less than -(2<sup>53</sup>) + 1 will result in loss of precision.  While this behavior is actually endorsed by RFC7159, due to the common use of `uint64_t`/`int64_t` types in modern software it would be preferable if the full range could be supported with full precision.\r\n\r\nThe pull request contains extensive changes to the code base however the majority of these are merely to introduce a new type, `number_unsigned_t`, which is required to support the upper range of `uint64_t`/`int64_t` values.  The flow on effect of this is the addition of companion constructors, operators and miscellaneous code that is required to implement the new type.  There are also very substantial changes to the unit testing (now just shy of 8000 assertions), again to accommodate the new type.  This new code is in the same form as that for the existing types so there will be no surprises.  A small number of additional unit tests check the performance of the parsing against the full range of the `uint64_t`/`int64_t` types.\r\n\r\nThe most controversial change is the change to the number parsing function `get_number()`.  This now attempts to parse the number both as an integer using `std::strloull()`/`std::strtoll()` and also using `std::strtold()` and then stores using the best representation.  This method was presented in the discussion for issue [#178](https://github.com/nlohmann/json/issues/178).\r\n\r\nThis method is far from ideal however the most likely alternatives seem to be either writing some custom (non-standard library based) number parsing function, or attempting to scan ahead in the string before parsing, or modifying the lexer to make the determination, or just accepting the reduced range.  Neither of these alternatives seems ideal."},"comment":{"url":"https://api.github.com/repos/nlohmann/json/issues/comments/174310224","html_url":"https://github.com/nlohmann/json/pull/183#issuecomment-174310224","issue_url":"https://api.github.com/repos/nlohmann/json/issues/183","id":174310224,"user":{"login":"nlohmann","id":159488,"avatar_url":"https://avatars.githubusercontent.com/u/159488?v=3","gravatar_id":"","url":"https://api.github.com/users/nlohmann","html_url":"https://github.com/nlohmann","followers_url":"https://api.github.com/users/nlohmann/followers","following_url":"https://api.github.com/users/nlohmann/following{/other_user}","gists_url":"https://api.github.com/users/nlohmann/gists{/gist_id}","starred_url":"https://api.github.com/users/nlohmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nlohmann/subscriptions","organizations_url":"https://api.github.com/users/nlohmann/orgs","repos_url":"https://api.github.com/users/nlohmann/repos","events_url":"https://api.github.com/users/nlohmann/events{/privacy}","received_events_url":"https://api.github.com/users/nlohmann/received_events","type":"User","site_admin":false},"created_at":"2016-01-24T15:34:58Z","updated_at":"2016-01-24T15:34:58Z","body":"Closed as requested by @twelsby."}}