Skip to content

Instantly share code, notes, and snippets.

@kazuho
Last active July 15, 2016 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuho/7e72372111fa0655692d9e44be70c7ea to your computer and use it in GitHub Desktop.
Save kazuho/7e72372111fa0655692d9e44be70c7ea to your computer and use it in GitHub Desktop.
$ node -v
v6.2.1
$ node -e 'console.log(JSON.parse("[0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100e400]"))'
[ 100 ]
$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
$ ruby -r JSON -e 'p JSON.parse("[0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100e400]")'
[0.0]
@kazuho
Copy link
Author

kazuho commented Jul 15, 2016

Same issue exists with smaller exponent:

$ node -e 'console.log(JSON.parse("[0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100e100]"))'
[ 100 ]
$ ruby -r JSON -e 'p JSON.parse("[0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100e100]")'
[0.0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment