Advance math class for Ruby