How to find Infinity in Ruby
1.9.3-p0 :001 > 1/0
ZeroDivisionError: divided by 0
1.9.3-p0 :002 > 1.0/0
=> Infinity
1.9.3-p0 :006 > -1.0/0
=> -Infinity
1.9.3-p0 :004 > Float::INFINITY
=> Infinity
1.9.3-p0 :005 > -Float::INFINITY
=> -Infinity
Written by Jiren Patel
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#