[plt-scheme] Division error in DrScheme v.4.1
On Wed, Aug 20, 2008 at 08:37:59AM -0500, Grant Rettke wrote:
> > When i'm calculating an expression wich returns integer values, like (/ 45
> > 5) or (/ 32 8), all goes just fine. But when i'm operating with fractions,
> > like (/ 4 23) or (* .04 6), DrScheme returns me an error instead and
> > crushes, error is
>
> I'm running DrScheme/mzscheme v4.1 [3m], when I choose the "Beginning
> Student" language and apply those functions I get:
>
> > (/ 4 23)
> 0.1739130434782608695652
> > (* .04 6)
> 0.24
If you open the "Choose Language" dialog and click on "Show Details",
you'll see an option to "Use decimal notation for rationals", which is
clearly selected in your case.
If memory serves correctly, the teaching languages default to using decimal
notation for rationals, because decimals are easier to read than a ratio of
two ~120-digit relatively-prime integers. (This situation arose several
times in teaching labs.) Changing the output printer saves us having to
explain exact->inexact, but at the cost of being able to show off
DrScheme's arbitrary-precision rationals. I think it's a net win, myself.
Richard