Skip to content

Instantly share code, notes, and snippets.

@ybur-yug
Last active August 29, 2015 14:19
Show Gist options
  • Save ybur-yug/0f400b63c8ed8871aa5f to your computer and use it in GitHub Desktop.
Save ybur-yug/0f400b63c8ed8871aa5f to your computer and use it in GitHub Desktop.
floats? wat?
0 == 0.0000000000000000000000000000000000000000000000000000000000001
# => false
0 == 0.00000000000000000000000000000000000000000000000000000000000001
# => true
0.00000000000000000000000000000000000000000000000000000000000001.to_s.count("0")
# => 2
0.00000000000000000000000000000000000000000000000000000000000001.to_s
# => "0.0"
0.0000000000000000000000000000000000000000000000000000000000001.to_s
# => "1.0e-61"
0 - 0.0 / 0
# => NaN
(1 - 0.0) / 0
# => Infinity
(1 - 0) / 0
# => ZeroDivisionError: divided by 0
# from (irb):11:in `/'
# from (irb):11
# from /usr/bin/irb:11:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment