In article <3E286515.4000301 / path.berkeley.edu>, Joel VanderWerf wrote:
> Robert Klemme wrote:
>> Hi there,
>> 
>> is there another way of accessing Infinity or -Infinity other than doing
>> 1.0/0 or -1.0/0?  I could not find any...  TIA!
> 
> I couldn't find anything either, so I do this sometimes:
> 
> class Float
>    Infinity = 1.0/0
> end
> 
> if -3.0/0 == Float::Infinity
>    puts "infinite"
> end

Is it reasonable to compare infinities?  I would tend to use
Float#finite? (there's also Float#nan? for not-a-numbers) so that I
could say

  if not (-3.0/0).finite?
    puts 'infinite'
  end

Mike

-- 
mike / stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       | GPG PGP Key      1024D/059913DA 
mike / exegenix.com                  | Fingerprint      0570 71CD 6790 7C28 3D60
http://www.exegenix.com/           |                  75D2 9EC4 C1C0 0599 13DA