[racket] read of numbers with decimal point default toexact?

From: Jos Koot (jos.koot at telefonica.net)
Date: Fri Jul 23 08:24:10 EDT 2010

Sorry about being pedantic.
Thinking about the default, I don't think I would object against Neil's
proposal.
Nevertheless a constant such as pi should remain inexact, I think.
Robby findler already mentioned read-decimal-as-inexact.
Jos 

> -----Original Message-----
> From: Stephen Bloch [mailto:bloch at adelphi.edu] 
> Sent: 23 July 2010 12:31
> To: neil at neilvandyke.org; users at racket-lang.org; 
> jos.koot at telefonica.net
> Subject: Re: [racket] read of numbers with decimal point 
> default toexact?
> 
> >>> "Jos Koot" <jos.koot at telefonica.net> 07/23/10 5:24 AM >>>
> >>  (/ (read (open-input-string "#e5.55")) #e1.11)
> 
> >> 5.55 and 1.11 are read as inexact reals, which are 
> flonums. In fact 
> >> in Racket all reals are rationals.
> >> There is good reason to distinguish exact reals from inexact ones, 
> >> because arithmetic operations on flonums usually are much faster.
> 
> I think Neil understands the above perfectly well; as I read 
> it, his suggestion was that, *by default*, the Racket reader 
> should choose correctness over efficiency, while allowing the 
> programmer to choose efficiency (via exact->inexact) if (s)he wishes.
> 
> Stephen Bloch




Posted on the users mailing list.