{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/web3.js/issues/322","labels_url":"https://api.github.com/repos/ethereum/web3.js/issues/322/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/web3.js/issues/322/comments","events_url":"https://api.github.com/repos/ethereum/web3.js/issues/322/events","html_url":"https://github.com/ethereum/web3.js/issues/322","id":108111577,"number":322,"title":"Consistency in number formats","user":{"login":"vbuterin","id":2230894,"avatar_url":"https://avatars.githubusercontent.com/u/2230894?v=3","gravatar_id":"","url":"https://api.github.com/users/vbuterin","html_url":"https://github.com/vbuterin","followers_url":"https://api.github.com/users/vbuterin/followers","following_url":"https://api.github.com/users/vbuterin/following{/other_user}","gists_url":"https://api.github.com/users/vbuterin/gists{/gist_id}","starred_url":"https://api.github.com/users/vbuterin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbuterin/subscriptions","organizations_url":"https://api.github.com/users/vbuterin/orgs","repos_url":"https://api.github.com/users/vbuterin/repos","events_url":"https://api.github.com/users/vbuterin/events{/privacy}","received_events_url":"https://api.github.com/users/vbuterin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-24T11:24:38Z","updated_at":"2015-09-24T16:45:35Z","closed_at":null,"body":"`web3.eth.contract` outputs bigNumber objects when returning outputs of functions; however, `web3.toWei` outputs strings. This essentially means that we now have three ways of representing numbers in web3:\r\n\r\n* As javascript numbers (basically, double-precision floats, 53 bit mantissa + 11 bit exponent so perfect accuracy only up to ~9 finney)\r\n* As strings\r\n* As bigNumber objects\r\n\r\nAnd there doesn't seem to be much logic behind why one format is chosen over the other. I recommend that we consider adding some consistency here, as it is otherwise confusing when outputs to web3 methods sometimes appear in one format and sometimes in the other. Perhaps we should restrict to two output types, so functions that return small numbers (eg. getTransactionCount) only return javascript numbers, and everything that might return a big number (especially including toWei) go into bigNumber format. Also, fromWei should IMO return an integer; it seems prudent to adopt the convention that values denominated in wei are meant to be exact, but everything else is for representation only and so using javascript numbers is fine."},"comment":{"url":"https://api.github.com/repos/ethereum/web3.js/issues/comments/142984004","html_url":"https://github.com/ethereum/web3.js/issues/322#issuecomment-142984004","issue_url":"https://api.github.com/repos/ethereum/web3.js/issues/322","id":142984004,"user":{"login":"wanderer","id":158211,"avatar_url":"https://avatars.githubusercontent.com/u/158211?v=3","gravatar_id":"","url":"https://api.github.com/users/wanderer","html_url":"https://github.com/wanderer","followers_url":"https://api.github.com/users/wanderer/followers","following_url":"https://api.github.com/users/wanderer/following{/other_user}","gists_url":"https://api.github.com/users/wanderer/gists{/gist_id}","starred_url":"https://api.github.com/users/wanderer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wanderer/subscriptions","organizations_url":"https://api.github.com/users/wanderer/orgs","repos_url":"https://api.github.com/users/wanderer/repos","events_url":"https://api.github.com/users/wanderer/events{/privacy}","received_events_url":"https://api.github.com/users/wanderer/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T16:45:35Z","updated_at":"2015-09-24T16:45:35Z","body":"acutely someone already did unit conversion in a seprate module. https://github.com/ryepdx/ethereum-units"}}