[plt-scheme] Printing

From: Evan Farrer (farrer at cs.utah.edu)
Date: Fri Oct 14 23:59:15 EDT 2005

This is a really simple question, but I can't find the answer anywhere (help-desk, google, etc.).  How do you control, how many decimal places get printed with a floating pointer number.

For example I want somthing like:

(define PI 3.1479)

(printf "~1.2a\n" PI) => 3.14

 or

(printf "~a\n" (decimal-places PI 2)) => 3.14


Thanks,

Evan




Posted on the users mailing list.