[racket] In need of flexpt

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun May 6 20:07:25 EDT 2012

I'd expect `flexpt' to be the same as `expt', but constrained to flonum
arguments, which would make it the same as

 (define (flexpt a x)
   (if (and (flonum? a) (flonum? x))
       (expt a x)
       (error ...s)))

I agree that it would make a fine addition to `racket/flonum', but is
that what you had in mind?

At Sun, 6 May 2012 15:05:07 +0200, Jens Axel Søgaard wrote:
> I am missing flexpt in racket/flonum.
> 
> I could live without, and use one of those below.
> However it looks as a natural operation to have in racket/flonum.
> 
> (define (flexpt1 a x)
>   (real->float (expt a x)))
> 
> (define (flexpt2 a x)
>   (flexp (fl* x (fllog a))))
> 
> The second is about twice as fast as the second,
> but sacrifices numeriacal precision.
> 
> --
> Jens Axel Søgaard
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users


Posted on the users mailing list.