[racket] Question about round

From: Jos Koot (jos.koot at telefonica.net)
Date: Fri Sep 30 05:16:30 EDT 2011

See section 3.1 and 3.2 of the R6RS (http://www.r6rs.org/
<http://www.r6rs.org/> ).
Also see section 3.2 of the Racket Reference.
An integer result can be inexact. Consider a result whose absolute error is
greater than 1. Than rounding it gives an inexact result. For example:
#lang racket
(= (inexact->exact (round (/ 1.0 1.1e-200)))
   (round (/ #e1.0 #e1.1e-200))) ; -> #f


From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org]
On Behalf Of Mark Engelberg
Sent: jueves, 29 de septiembre de 2011 23:11
To: users at racket-lang.org
Subject: [racket] Question about round

I'm a bit baffled by this behavior:

> (exact? (round (sin 30)))
> (integer? (round (sin 30)))

How is it possible to have an inexact integer?

I would expect the answer to both of these tests to be true.



Posted on the users mailing list.