[racket] What is inexactness about?

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Wed Sep 1 09:14:34 EDT 2010

I've been having an interesting discussion off-list with David Kay, but have concluded that we need the expertise of somebody more knowledgeable about Scheme/Racket and its philosophy.

The "#i" indicates that a number is inexact, and that further computation based on it should be interpreted accordingly.  The Scheme/Racket numeric libraries automatically mark as "inexact" most results of trig, exponential, log, sqrt, and similar functions, even if the inputs were exact, because the mathematically correct answers to these are irrational.  Likewise, 

The question is under what circumstances (if any) you would want to mark something as inexact that DIDN'T come from an irrational-valued library function or constant.  An example in my textbook is

(define TANK-CAPACITY-GALLONS #i13.6)
(define MPG #i28)

because the capacity of a gas tank, and miles-per-gallon fuel efficiency, are based on physical measurements and therefore inherently inexact.  On the other hand, you could work through this entire example using exact numbers, and everything would come out correctly (since the only arithmetic involved is addition, subtraction, multiplication, and division), so the argument could be made that putting #i in there is distracting and pedantic.

Opinions?  Corrections?



Stephen Bloch
sbloch at adelphi.edu



Posted on the users mailing list.