Skip to content

Instantly share code, notes, and snippets.

@rentalcustard
Created July 18, 2013 11:11
Show Gist options
  • Save rentalcustard/6028502 to your computer and use it in GitHub Desktop.
Save rentalcustard/6028502 to your computer and use it in GitHub Desktop.
~> irb
1.9.3-p194 :001 > 10.0 / 0.0
=> Infinity
1.9.3-p194 :002 > 0.0 / 0.0
=> NaN
1.9.3-p194 :003 > 10 / 0
ZeroDivisionError: divided by 0
from (irb):3:in `/'
from (irb):3
from /Users/thomasstuart/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3-p194 :004 > 10 / 0.0
=> Infinity
1.9.3-p194 :005 > Nan
NameError: uninitialized constant Nan
from (irb):5
from /Users/thomasstuart/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3-p194 :006 > NaN
NameError: uninitialized constant NaN
from (irb):6
from /Users/thomasstuart/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3-p194 :007 > Infinity
NameError: uninitialized constant Infinity
from (irb):7
from /Users/thomasstuart/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
1.9.3-p194 :008 > infin = 10 / 0.0
=> Infinity
1.9.3-p194 :009 > infin
=> Infinity
1.9.3-p194 :010 > infin.class
=> Float
1.9.3-p194 :011 > nan = 0.0 / 0.0
=> NaN
1.9.3-p194 :012 > nan.class
=> Float
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment