On 13 October 2017 at 13:51, Marc Feeley <xxxxxx@iro.umontreal.ca> wrote: > I’ve found this code works well for me… > > (define (num->string num w d) ; w = total width, d = decimals > (let ((n (round (* (abs (inexact->exact num)) (expt 10 d))))) > (let ((i (quotient n (expt 10 d))) > (f (modulo n (expt 10 d)))) > (let ((si (string-append > (if (< num 0) "-" "") > (number->string i 10))) > (sf (if (> d 0) > (let ((sf (number->string (+ f (expt 10 d)) 10))) > (string-set! sf 0 #\.) > sf) > ""))) > (let ((lsi (string-length si)) > (lsf (string-length sf))) > (let ((blanks (- w (+ lsi lsf)))) > (string-append (make-string (max blanks 0) #\space) si sf))))))) > > Perhaps that’s better for your purpose than srfi-48. Thank you. I will give it a try. /Don