From 9af3241d1754be8395caeadd4199e01cecc44b61 Mon Sep 17 00:00:00 2001 From: Sascha Hanse Date: Fri, 18 Aug 2017 21:13:49 +0200 Subject: [PATCH] fix the code for `convertBigintToBase` --- IOTA-Kerl-spec.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IOTA-Kerl-spec.md b/IOTA-Kerl-spec.md index 356252f..d9ad43d 100644 --- a/IOTA-Kerl-spec.md +++ b/IOTA-Kerl-spec.md @@ -177,11 +177,11 @@ def convertBigintToTrits(bigInt): ``` def convertBigintToBase(bigInt,base,length): is_negative = bigInt < 0 - absolute_value = abs(bigInt) + quotient = abs(bigInt) MAX = is_negative ? base/2 : (base-1)/2 for i=1:length: - quotient,remainder = divmod(absolute_value, base) + quotient,remainder = divmod(quotient, base) if remainder > MAX: # Lend 1 to the next place so we can make this digit negative. quotient += 1