From: Kent Dahl Date: 2003-01-18T08:28:48+09:00 Subject: Re: Accessing Infinity Joel VanderWerf wrote: > > But... > > (1.2).equal?(1.2) # ==> false > (10**100).equal?(10**100) # ==> false > > Does that mean there are an infinity of googols? Maybe, I'm no math buff, but I was thinking more about the fact that they are heap allocated entities. When I read "two infinities" before "reasonable to compare with them", I thought you might be under the illusion that the infinity objects are shared single instances or immediate values. My bad, and good to see you aren't. > I don't think #equal? is the mathematically correct comparison for > numbers that may be implemented as heap allocated entities. That's the > job of #==. And checking for infinity isn't the job of neither of those, but Float#infinite? since it is such a special value. Using #== is a bad idea for Floats in general due to imprecision, and chucking them up for infinity goes against code clarity, 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___)