From: Stephen Bloch (bloch at adelphi.edu) Date: Thu Sep 29 18:00:39 EDT 2011 Previous message: [racket] Question about round Next message: [racket] Question about round Messages sorted by: [date] [thread] [subject] [author]

```On Sep 29, 2011, at 5:11 PM, Mark Engelberg wrote:

> How is it possible to have an inexact integer?

That threw me, too, the first time I encountered it.

Where do inexact numbers come from?  Two common sources: physical measurement, and computations whose exact results can't be represented in any of the standard numeric formats.  So for example the location of the mouse is a physical measurement, and therefore inherently inexact.  However, it's measured in pixels, so it's an integer (or rather a pair of integers).

Now, how about an inexact computation whose result, to within rounding error, is an integer?

(define x #i1.000000000000001)
x ; not 1
(sqrt x) ; #i1.0000000000000004
(sqrt (sqrt x)) ; #i1.0000000000000002
(sqrt (sqrt (sqrt x))) ; #i1.0

But mathematically, the answer shouldn't be 1 because it's the square root of something that wasn't 1, so the "inexact" marker is correct.

Stephen Bloch