From: Kent Dahl Date: 2003-01-18T06:28:14+09:00 Subject: Re: Accessing Infinity Joel VanderWerf wrote: > Well, Ruby's floating point number system does include two infinities, > so I guess it's reasonable to compare with them... This might sound a bit pedantic but: Ruby doesn't provide the two infinitive numbers. The underlying floating point routines do. So you don't have two infinities, since any Float object can be infinite. You can have an infinite number of infinities. $ irb irb(main):001:0> a = 1.0/0 Infinity irb(main):002:0> b = 1.0/0 Infinity irb(main):003:0> a.id 537929428 irb(main):004:0> b.id 537915848 irb(main):005:0> a.equal? b false So the only use for the Infinity constants I can see, is for clarity (and space conserving) when you explicitly assign Infinity to more than one variable. Creating them for comparison is just plain wasteful, as it is one more object in ObjectSpace and a more complicated comparison, having to look into two objects instead of one. IMHO -- (\[ Kent Dahl ]/)_ _~_ __[ http://www.stud.ntnu.no/~kentda/ ]___/~ ))\_student_/(( \__d L b__/ NTNU - graduate engineering - 5. year ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)