[racket] read of numbers with decimal point default to exact?

From: Stephen Bloch (bloch at adelphi.edu)
Date: Fri Jul 23 06:30:36 EDT 2010

>>> "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.