[plt-dev] Inexact integers
JavaScript returns NANs in various places.
Shriram
On Tue, May 25, 2010 at 10:48 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Tue, May 25, 2010 at 6:49 AM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
>> [It sure would be nice to provide a "JavaScript numbers" language
>> level in DrScheme, so people can test under browser numbers and make
>> sure those are sufficient for their programs. If they are, Moby can
>> generate much simpler and vastly faster code.]
>
> Wouldn't this just be this (untested, not right for keywords, quasiquote):
>
> #lang racket
> (provide (except-out (all-from-out racket) quote #%datum)
> (rename-out [-#%datum #%datum] [-quote quote]))
> (define-syntax-rule (-#%datum arg) (-quote arg))
> (define-syntax (-quote arg)
> (syntax-case arg ()
> [(_ i)
> (and (number? i) (not (inexact? i)))
> #'(exact->inexact (quote i))]
> [(_ i) (quote i)]))
>
> Or maybe just a reader change to read all numbers as inexact?
>
>
>
> --
> sam th
> samth at ccs.neu.edu
>