Fix to_base for 0.
Further proof that nobody is using this code.
This commit is contained in:
parent
f8c0d46c5e
commit
bf2865077a
1 changed files with 2 additions and 0 deletions
|
@ -68,6 +68,8 @@ def to_base(number, base, decimal_places=10, alphabet=None):
|
|||
result = ''
|
||||
whole_portion = int(number)
|
||||
float_portion = number - whole_portion
|
||||
if whole_portion == 0:
|
||||
result = alphabet[0]
|
||||
while whole_portion > 0:
|
||||
(whole_portion, remainder) = divmod(whole_portion, base)
|
||||
result = alphabet[remainder] + result
|
||||
|
|
Loading…
Reference in a new issue