--- /home/arthur/tmp/srfi-48.scm.~1~ 2017-10-11 13:51:18.285549747 -0700 +++ /home/arthur/tmp/srfi-48.scm 2017-10-11 14:24:44.503147871 -0700 @@ -80,11 +80,13 @@ (new-frac (substring temp-str 0 digits)) ) - (string-append - (if carry? (number->string (+ 1 (string->number pre-str))) pre-str) - "." - new-frac - exp-str))) + (let ( (pre-str* (if (string=? pre-str "") "0" pre-str)) + ) + (string-append + (if carry? (number->string (+ 1 (string->number pre-str*))) pre-str) + "." + new-frac + exp-str)))) ) ) ) (define (format-fixed number-or-string width digits) ; returns a string