guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf(".2lf", x) in Guile Scheme?


From: David Séverin
Subject: Re: printf(".2lf", x) in Guile Scheme?
Date: Wed, 17 Sep 2008 01:41:26 -0300

Le Tue, 16 Sep 2008 18:34:09 -0700 (PDT),
walrus <address@hidden> a écrit :

> 
> How to display a real number with exactly two decimal digits in Guile Scheme?
> Just like
> printf(".2f", x) in C
> Thanks!

Hello Walrus,

;; --

        http://www.gnu.org/software/guile/manual/guile.html

                6.8 Formatted Output

                        ~f      Fixed-point float. Parameters: ...
;; --

(use-modules (ice-9 format))
(format #t "~1,2f" 3.125)
(format #t "~1,2f" .125)
(format #t "~,2f" .125)
... ...

David

ps: I would ask this type of question on address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]