[gambit-list] Why is flonum arithmetic so slow?

TJay tjay.dreaming at gmail.com
Sun Nov 13 15:09:36 EST 2005


Hi :)
I'm curious as to why flonum atrihmetic is so much slower than fixnum
arithmetic.
For example, the following naive benchmark runs in .8 seconds (as fast as C
code!) when declare'd as fixnum, but takes 99 seconds(!) to run in flonum
mode.

(define iterate-till-zero
(lambda (n)
(if (> n 0)
(iterate-till-zero (- n 1)))))

(time (let loop ((n 1000))
(iterateTillZero 1000000)
(if (> n 0)
(loop (- n 1)))))

Does Gambit do some special mojo when dealing with "flonum"s? If so, is
there a way to disable said mojo's? I just need fast inexact floating point
arithmetic. (C style float or double numbers meet my needs just fine.)

~ TJay ~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20051114/298a8e3e/attachment.htm>


More information about the Gambit-list mailing list