# $Id: numeric.rb,v 1.1 2002/04/08 20:45:22 knu Exp $

require 'features/ruby18/base'

[Integer, Fixnum, Bignum].each do |klass|
  klass.module_eval {
    alias __ruby16_to_s to_s

    def to_s(base = 10)
      case base
      when 10
	__ruby16_to_s()
      when 16
	'%x' % self
      when 8
	'%o' % self
      when 2
	'%b' % self
      else
	raise ArgumentError, "illegal radix #{base}"
      end
    end
  }
end
