{"action":"created","issue":{"url":"https://api.github.com/repos/json4s/json4s-ast/issues/7","labels_url":"https://api.github.com/repos/json4s/json4s-ast/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/json4s/json4s-ast/issues/7/comments","events_url":"https://api.github.com/repos/json4s/json4s-ast/issues/7/events","html_url":"https://github.com/json4s/json4s-ast/issues/7","id":97290811,"number":7,"title":"\"Correct\" representation of a Javascript number is a Double","user":{"login":"mdedetrich","id":2337269,"avatar_url":"https://avatars.githubusercontent.com/u/2337269?v=3","gravatar_id":"","url":"https://api.github.com/users/mdedetrich","html_url":"https://github.com/mdedetrich","followers_url":"https://api.github.com/users/mdedetrich/followers","following_url":"https://api.github.com/users/mdedetrich/following{/other_user}","gists_url":"https://api.github.com/users/mdedetrich/gists{/gist_id}","starred_url":"https://api.github.com/users/mdedetrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdedetrich/subscriptions","organizations_url":"https://api.github.com/users/mdedetrich/orgs","repos_url":"https://api.github.com/users/mdedetrich/repos","events_url":"https://api.github.com/users/mdedetrich/events{/privacy}","received_events_url":"https://api.github.com/users/mdedetrich/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-26T06:07:33Z","updated_at":"2015-07-26T06:20:03Z","closed_at":null,"body":"Current representation of a `JNumber` is a `BigDecimal`, which implies an infinite precision real number. The javascript spec (http://stackoverflow.com/questions/3605925/does-javascript-have-double-floating-point-number-precision) specifies that a `Javascript` number is actually a 64 precision double, which is the exact same type as `Double`/`double` in `Scala`/`Java`. `Double` is also used in `Scala.js` to represent the `Javascript` number type (which is how I came across this)\r\n\r\nFor this reason, there may be an argument that having `JNumber` as a `Double` is more \"correct\" than `BigDecimal` (it will also have better performance). The downside is, that if you want to do maths on the `Double`, you will have to convert to a `BigDecimal` first if you want to do correct math operations\r\n\r\nThoughts?"},"comment":{"url":"https://api.github.com/repos/json4s/json4s-ast/issues/comments/124950136","html_url":"https://github.com/json4s/json4s-ast/issues/7#issuecomment-124950136","issue_url":"https://api.github.com/repos/json4s/json4s-ast/issues/7","id":124950136,"user":{"login":"xuwei-k","id":389787,"avatar_url":"https://avatars.githubusercontent.com/u/389787?v=3","gravatar_id":"","url":"https://api.github.com/users/xuwei-k","html_url":"https://github.com/xuwei-k","followers_url":"https://api.github.com/users/xuwei-k/followers","following_url":"https://api.github.com/users/xuwei-k/following{/other_user}","gists_url":"https://api.github.com/users/xuwei-k/gists{/gist_id}","starred_url":"https://api.github.com/users/xuwei-k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xuwei-k/subscriptions","organizations_url":"https://api.github.com/users/xuwei-k/orgs","repos_url":"https://api.github.com/users/xuwei-k/repos","events_url":"https://api.github.com/users/xuwei-k/events{/privacy}","received_events_url":"https://api.github.com/users/xuwei-k/received_events","type":"User","site_admin":false},"created_at":"2015-07-26T06:20:03Z","updated_at":"2015-07-26T06:20:03Z","body":"> \"Correct\" representation of a Javascript number is a Double\r\n\r\nThat is right. But I think json4s-ast is **JSON** AST for Scala, not JavaScript. Furthermore, JSON number is not same JavaScript number (JSON number is not limited).\r\n\r\nhttp://stackoverflow.com/a/13502497"}}