[racket] read of numbers with decimal point default to exact?
Robby Findler wrote at 07/23/2010 08:09 AM:
> The read-decimal-as-inexact parameter allows you to change read's
> behavior in this way. Is that what you're looking for?
Yes (with the addition of a corresponding write parameter), but...
* I was idly toying with the idea of that being the default. It's a
little funny that the Scheme number system lets a naive programmer use
arbitrarily huge numbers, yet a naive programmer evaluating "(/ 3.3
1.1)" gets an 'incorrect' answer. I won't belabor this point further.
* To support programmers who want to use exact numbers by default, such
as some financial programmers, without making that the default for
Racket, let's say we define a new Racket variant for these programmers
("#lang numbers-racket", heh). In this case, I'm wondering whether
there is a problem with any Racket *libraries* confusing these
programmers when the numbers they get out of the libraries can quietly
become inexact. Perhaps the solution here is simply that authors of
numerical libraries should provide multiple two versions of certain of
operations: a version that preserves exactness, and a version that is fast?
I don't have a pressing need for any of this. Just wanted to throw the
idea out there in case it resonated with anyone.
--
http://www.neilvandyke.org/