Changed float division to integer division

This commit is contained in:
Keith Jones 2004-02-10 03:21:45 +00:00
parent 03ebdc3512
commit 5eac427f15

View File

@ -104,7 +104,7 @@ class Math(callbacks.Privmsg):
else: else:
digit = str(digit) digit = str(digit)
valStr = digit + valStr valStr = digit + valStr
number = int(math.floor(number / base)) number = number // base
if negative: if negative:
return '-%s' % valStr return '-%s' % valStr
else: else:
@ -116,6 +116,8 @@ class Math(callbacks.Privmsg):
base, 2 through 36. Returns a string. base, 2 through 36. Returns a string.
""" """
number = long(str(number), fromBase) number = long(str(number), fromBase)
if toBase == 10:
return str(number)
return self._convertDecimalToBase(number, toBase) return self._convertDecimalToBase(number, toBase)
_mathEnv = {'__builtins__': types.ModuleType('__builtins__'), 'i': 1j} _mathEnv = {'__builtins__': types.ModuleType('__builtins__'), 'i': 1j}