[racket-dev] [racket] Question about round

From: Stephen Bloch (bloch at adelphi.edu)
Date: Sat Oct 1 12:41:26 EDT 2011

On Oct 1, 2011, at 12:54 AM, David T. Pierson wrote:

> On Fri, Sep 30, 2011 at 11:59:25AM -0400, Vincent St-Amour wrote:
>> Here's a proposal:
>> `integer?' becomes the same as `exact-integer?' (which is kept for
>> backwards compatibility).
> It is not clear to me from the responses to this proposal whether it is
> still being considered.  If so I feel motivated to question it.
> ...
> So the original confusion was due to round returning an inexact? number.
> The above proposal does not address that confusion, but instead makes
> integer? return #f for inexact? inputs.  So:
>  (integer? 1.0) ; would be #f

I think Vincent was proposing that "round" continue to return an integer (which makes sense -- that is its raison d'etre) but that all integers be exact.  At present, "round" always returns an integer, but this integer is exact only if the input was exact.

(Correction: "round" does NOT always return an integer, e.g. (round +inf.0) .  There are probably other counterexamples, but I haven't thought of them.)

Stephen Bloch
sbloch at adelphi.edu

Posted on the dev mailing list.