Subject: Re: PLT DrScheme
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/06/04
Newsgroups: comp.lang.scheme
Message-ID: <6l5hm3$4tt5h@fido.engr.sgi.com>

Klaus M. Rodewig <klaus.rodewig@post.rwth-aachen.de> wrote:
+---------------
| How do I get my compiler (PLT DrScheme) to evaluate to floating point
| numbers? It just shows fractional numbers.
+---------------

Those are called "rationals" (see the Scheme standard). While quite useful
for doing numerical analysis, they can indeed be a pain sometimes when all
you wanted was to use Scheme as a glorified desk calculator! ;-}

Anyway, what I do when I want to force floats in DrScheme/MzScheme is
just add "0.0" to the number:

	> (/ 3 4)
	3/4
	> (+ 0.0 (/ 3 4))
	0.75


-Rob

p.s. If that's not good enough for you, go get the "format" implementation
from SLIB and use it to print your numbers:

	> (format #f "~6,3f" (/ 3 4))
	" 0.750"

[Caveat: DrScheme may complain when you redefine its "format", which
is miles & miles from a full CL-style "format"...]


-----
Rob Warnock, 7L-551		rpw3@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA