[racket-dev] (round), etc. in Typed Racket
That reassures me. Thanks.
Would we not have the same problem with 'rational?'.
All reals, both exact and inexact ones are rationals (for the obvious reason
that we cannot represent every irrational number in finite memory)
Would we not need the same distinction between 'exact-rational?' and
'inexact-rational?'. May be 'rational?' should mean 'exact-rational?' and
'real?' should mean 'inexact-real?' or 'inexact-rational?'.
And how about exact and inexact 'complex?'?
I have the feeling that the numeric tower is tilting like that of Pisa.
Nevertheless I see some advantage in the R6RS tower of numbers. Although all
numbers as stored in memory have exact representations (though may be
several of kilobytes), it remains useful to know whether or not along the
computation of a number, the system was forced to produce an approximation
(as in (sqrt 2)).
When it comes to efficiency, flonums may be preferred, but it is not
difficult to enforce a function to do all its computations with flonums.
Jos
> -----Original Message-----
> From: Noel Welsh [mailto:noelwelsh at gmail.com]
> Sent: 13 December 2010 16:18
> To: Jos Koot
> Cc: dev at racket-lang.org
> Subject: Re: [racket-dev] (round), etc. in Typed Racket
>
> At this point we're just talking about nomenclature. I think
> round would still return an inexact integer, as it does at
> the moment, but we wouldn't call this an integer.
>
> (More broadly I find the numeric tower more hassle than help.
> A lot of my code cares about efficiency and interacting with
> C libraries, so perhaps I'm atypical.)
>
> N.
>
> On Mon, Dec 13, 2010 at 3:11 PM, Jos Koot
> <jos.koot at telefonica.net> wrote:
> > Does this also mean that procedures like round, floor and
> ceiling will
> > produce exact integers even when given an inexact argument?
> I am not
> > sure this would be a good idea. For example consider:
> > Now (round #i1e200) -> flonum of 64 bits.
> > But (inexact->exact (round #i1e200)) -> exact integer of
> over 600 bits.
> > Nevertheless the idea of making a distinction between integer? and
> > inexact-integer? (or whatever you want to name them) seems to be a
> > good idea. However, we already have integer? and exact-integer?
> > Am I missing the pointe of the discussion?
> > Jos