[gambit-list] number->integer

David Rush kumoyuki at gmail.com
Thu Oct 30 09:33:11 EDT 2008


On Thu, Oct 30, 2008 at 2:32 AM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
> (define (f0 x)  ;; 4600 ns per call
>   (declare (standard-bindings))
>   (inexact->exact (truncate x)))
>
> (define (f1 x)  ;; 4000 ns per call
>   (declare (standard-bindings))
>   (truncate (inexact->exact x)))

This is *really* interesting w/rt the implementation model of floats.
I would guess that this means that inexact->exact just flips an
exactness bit in Gambit's float representation, no? I would have
thought that truncating an exact rational would be rather expensive in
comparison to normalizing a floating integer. I'd think that
truncating a float would be relatively cheap.

What's really going on here?

david
-- 
GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt



More information about the Gambit-list mailing list