[racket] Question about round
Just to clear up one more possible point: the rational? predicate
actually recognizes inexact numbers, eg:
[robby at penghu] ~/git/plt/collects/drracket/private$ racket
Welcome to Racket v5.1.3.9.
> (rational? (sqrt 2))
#t
Robby
On Fri, Sep 30, 2011 at 11:18 AM, Mark Engelberg
<mark.engelberg at gmail.com> wrote:
> I'm amazed at how long I've gone with the misconception that:
> Exact Numbers = Integers union Rationals
> Inexact Numbers = Floating Point numbers
> (Frankly, I never really thought much about what infinities were. I assumed
> they were a separate, distinct type).
>
> When I saw in the docs for round that it returns an integer, and I was
> getting an inexact number, I was sure it was a mistake. Thanks for helping
> me straighten out my thinking on this. I can see how you might want to test
> an inexaxct number for whether it is the floating point approximation of an
> "integer", so that makes sense. Still seems weird and inconvenient for
> round to give you back an inexact integer rather than an exact one, but I
> can see now how this behavior matches the standard.
>
> Thanks,
>
> Mark
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users
>