From 4b5d5017c43ec6a48798b84071b66f9d59bcdce9 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Fri, 5 Jul 2019 15:52:04 +0200 Subject: [PATCH] Fix remainder handling. * mes/module/mes/scm.mes (number->string): Fix remainder handling. * build-aux/check-mescc.sh (XFAIL_TESTS): Remove lib/tests/scaffold/60-math.c. --- build-aux/check-mescc.sh | 1 - mes/module/mes/scm.mes | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build-aux/check-mescc.sh b/build-aux/check-mescc.sh index 4eca9314..522ed775 100755 --- a/build-aux/check-mescc.sh +++ b/build-aux/check-mescc.sh @@ -234,7 +234,6 @@ lib/tests/scaffold/91-goto-array.c if test $mes_cpu = x86; then XFAIL_TESTS="$XFAIL_TESTS -lib/tests/scaffold/60-math.c " fi diff --git a/mes/module/mes/scm.mes b/mes/module/mes/scm.mes index 327750b9..4b4f4c94 100644 --- a/mes/module/mes/scm.mes +++ b/mes/module/mes/scm.mes @@ -264,7 +264,7 @@ (let* ((radix (if (null? rest) 10 (car rest))) (sign (if (< n 0) '(#\-) '()))) (let loop ((n (abs n)) (lst '())) - (let* ((i (remainder n radix)) + (let* ((i (abs (remainder n radix))) (lst (cons (integer->char (+ i (if (< i 10) (char->integer #\0) (- (char->integer #\a) 10)))) lst)) (n (quotient n radix)))