= Radix Integer Radix provides an Integer class for working with integers in various bases. require 'radix' Radix extend the Integer, String and Array classes with the #b method which simplifies the creation of Radix::Integer instances. The following return the equivalent instance of Radix::Integer. a = 8.b(2) b = "1000".b(2) c = [1, 0, 0, 0].b(2) a.assert == b b.assert == c c.assert == a a.assert == 8 b.assert == 8 c.assert == 8 Radix integers can ve converted to other bases with the #convert method. b = "1000".b(2) d = b.convert(10) d.digits.assert == [8] Radix::Integer supports all the usual mathematical operators. r = "1000".b(2) + "2".b(8) r.assert == "1010".b(2) r.assert == "12".b(8) r.assert == "10".b(10) A more complex example with a much higher base. r = "AZ42".b(62) + "54".b(10) r.assert == "2518124".b(10) r.assert == 2518124 Work with arrays for bases greater than 62. r = [100,10].b(256) + "54".b(10) r.assert == "25664".b(10)