# File lib/facets/more/infinity.rb, line 83
  def times
    loop do yield end
  end

  # Coerce allows other numbers to be
  # compared to infinity.

  def coerce(other)
    case other
    when InfinityClass
      super
    else
      return -self, other
    end
  end

  # Equality. Note that NaN != NaN.

  def ==(other)
    case other
    when InfinityClass
      if @direction == 0 and other.direction == 0
        false
      else
        super
      end
    else
      false
    end
  end

  # Comparision where infinity is alway greatest
  # and negative infinityalways least.

  def <=>(other)
    case other
    when InfinityClass
      @direction <=> other.direction
    else
      @direction
    end
  end

  #

  def to_s
    case @direction
    when  0  : "NaN"
    when  1  : "PosInf"
    when -1  : "NegInf"
    end
  end

end