# frozen_string_literal: true
# date.rb: Written by Tadayoshi Funaba 1998-2011
VERSION = '3.2.2' # :nodoc:
class Infinity < Numeric # :nodoc:
def initialize(d=1) @d = d <=> 0 end
def infinite?() d.nonzero? end
def abs() self.class.new end
def -@() self.class.new(-d) end
def +@() self.class.new(+d) end
when Infinity; return d <=> other.d
when Float::INFINITY; return d <=> 1
when -Float::INFINITY; return d <=> -1
l, r = other.coerce(self)
when Numeric; return -d, d