# File lib/standard/facets/interval.rb, line 193
  def each(n=nil, d=nil)  # :yield:
    if n
      warn "FACETS: `interval.each(n,d){...}` will be deprecated.\n" +
           "Use `interval.step(n,d).each{...}` instead."
    else
      n = 1
    end

    return (n < 0 ? @last : @first) if degenerate?  # is this right for all values of n ?

    s = d ? self.length.to_f * (n.to_f / d.to_f) : n.abs
    raise "Cannot iterate over zero length steps." if s == 0
    s = s * @direction
    if n < 0
      e = @exclude_last ? @last - s : @last
      #e = @exclude_last ? @last.pred(s) : @last
      t = @exclude_last ? 1 : 0
      #while e.cmp(@first) >= t
      while (e <=> @first) >= t
        yield(e)
        e -= s
        #e = e.pred(s)
      end
    else
      e = @exclude_first ? @first + s : @first
      #e = @exclude_first ? @first.succ(s) : @first
      t = @exclude_last ? -1 : 0
      #while e.cmp(@last) <= t
      while (e <=> @last) <= t
        yield(e)
        e += s
        #e = e.succ(s)
      end
    end
  end