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

*To*: <plt-scheme@fast.cs.utah.edu>*Subject*: Re: dumb DrScheme rational # question*From*: Richard Cobbe <cobbe@airmail.net>*Date*: Tue, 29 Jan 2002 17:32:21 -0600 (CST)*In-Reply-To*: <E16Vad7-0006ZO-00@hawk.prod.itd.earthlink.net>*References*: <Pine.SGI.4.33.0201291046370.27459769-100000@buphy.bu.edu><E16Vad7-0006ZO-00@hawk.prod.itd.earthlink.net>*Sender*: owner-plt-scheme@fast.cs.utah.edu

Lo, on Tuesday, January 29, Robert Bruce Findler did write: > Quoting Brian Gregor: > > > > DrScheme (v 200alpha9) returns rational #'s for many > > division operations. Is there a way to force it to > > convert to a floating point number? Common Lisp > > has a 'float' function for this, but MzScheme doesn't > > seem to have any such equivalent. > > You can use exact->inexact, or if you start your computations with > inexact numbers, they will remain inexact when going thru the division > operations. To write an inexact constant, prefix the numbers with #i, > like this: > > #i1.0 > > Additionally, if you use functions that return real results (sin, sqrt, > log, etc) you will get inexact numbers from them. > > But, you should really only be doing that kind of thing if you are > running into efficiency issues, I'd say. Well, there is another reason, and this actually came up in 210 labs from time to time. Most of the students seemed to think that 2625606.344290554 was more informative as a final answer than 13468902349083467982348905427892890234980624/5129825489023489026890234908253890235. Maybe it's just me, but I can't say I blame them. Richard

**Follow-Ups**:**Re: dumb DrScheme rational # question***From:*Matthias Felleisen <matthias@ccs.neu.edu>

**References**:**dumb DrScheme rational # question***From:*Brian Gregor <bgregor@BUPHY.bu.edu>

**Re: dumb DrScheme rational # question***From:*Robert Bruce Findler <robby@cs.rice.edu>

- Prev by Date:
**Re: dumb DrScheme rational # question** - Next by Date:
**Re: dumb DrScheme rational # question** - Prev by thread:
**Re: dumb DrScheme rational # question** - Next by thread:
**Re: dumb DrScheme rational # question** - Index(es):