[plt-scheme] C-style Printf Format Convention?

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Wed May 12 10:51:00 EDT 2004

John Clements wrote:

 > (define (limit-digits x num)
     (let ([y (expt 10 x)])
       (number->string (/ (exact->inexact (round (* num y))) y))))

 > (limit-digits 0 3)
"3.0"

 > (limit-digits 1 2)
"2.0"

 > (limit-digits 2 2)
"2.0"




Posted on the users mailing list.