[Q] Infinity -- Float

It seems that Ruby has a concept of infinity:

1.0/0
=> Infinity
(1.0/0).class
=> Float

I wish to return this value, but I can’t quite figure out what Ruby’s
symbol for Infinity is. I guess that I could write:

my_method

return 1.0/0
end

But I’d rather do something like

my_method

return Infinity
end

(Replace “Infinity” by the appropriate value).

Does anyone know what symbol Ruby uses for “Infinity”?

···


Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/61840

···

On Tue, Feb 18, 2003 at 10:51:47AM +0900, Daniel Carrera wrote:

It seems that Ruby has a concept of infinity:

1.0/0
=> Infinity
(1.0/0).class
=> Float

I wish to return this value, but I can’t quite figure out what Ruby’s
symbol for Infinity is. I guess that I could write:

my_method

return 1.0/0
end


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

…Deep Hack Mode – that mysterious and frightening state of
consciousness where Mortal Users fear to tread.
– Matt Welsh

Thanks.

···

On Tue, Feb 18, 2003 at 04:45:42PM +0900, Mauricio Fernández wrote:

On Tue, Feb 18, 2003 at 10:51:47AM +0900, Daniel Carrera wrote:

It seems that Ruby has a concept of infinity:

1.0/0
=> Infinity
(1.0/0).class
=> Float

I wish to return this value, but I can’t quite figure out what Ruby’s
symbol for Infinity is. I guess that I could write:

my_method

return 1.0/0
end

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/61840


_ _

__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_ _ \ / ` | ’ \
) | (| | |
__ \ | | | | | (| | | | |
.__/ _,
|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com

…Deep Hack Mode – that mysterious and frightening state of
consciousness where Mortal Users fear to tread.
– Matt Welsh


Daniel Carrera
Graduate Teaching Assistant. Math Dept.
University of Maryland. (301) 405-5137