[racket-dev] Sublinear functions of superfloat numbers

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Jul 1 18:02:06 EDT 2012

1. What's the computational cost of such changes? 

2. What is the impact on TR? 3. 


On Jun 30, 2012, at 9:15 PM, Neil Toronto wrote:

> I've noticed something interesting about the `log' function. Check out this interaction:
> 
> > (real->double-flonum #e1e400)
> +inf.0
> > (log #e1e400)
> 921.0340371976183
> 
> It's obviously not just converting to flonum first; it's likely doing some kind of argument reduction internally.
> 
> `sqrt' operates on superfloat numbers when they're perfect squares, and `sin' doesn't at all:
> 
> > (sqrt #e1e400)
> [1e200 written out]
> > (sqrt #e1e401)
> +inf.0
> > (sin #e1e400)
> +nan.0
> 
> I have two questions:
> 
> 1. I think I have the Mad Skillz to make these work by wrapping the primitives with something that does argument reduction. Should I? (It should be especially interesting to do `sin', requiring an arbitrary-precision `pi' constant. Woo!)
> 
> 2. Under what circumstances should sublinear `math' library functions do this? All of them?
> 
> Neil ⊥
> _________________________
> Racket Developers list:
> http://lists.racket-lang.org/dev



Posted on the dev mailing list.