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

From: John Clements (clements at brinckerhoff.org)
Date: Wed May 12 10:55:27 EDT 2004

On May 12, 2004, at 10:51 AM, Jens Axel Søgaard wrote:

>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> 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"

Yes, of course you're right.  I take it all back.

john "back to real work" clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2169 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20040512/d4c41ec4/attachment.p7s>

Posted on the users mailing list.