thebjorn <BjornSteinarFjeldPettersen@gmail.com> wrote:
+
 > > (defun sumevenfibs (howmany)
 > (let ((x (loop ... )))
 > (ceiling (log x 10))))
...
 > > (time (sumevenfibs 100000))

 I got floating point overflow here running on CLisp (it was the easiest
 accessible on xp at the time I downloaded it...) I'll look into CMUCL
 over the weekend.
+
It will certainly run much faster on CMUCL. But try this variation
on CLISP in the meantime: Replace the (CEILING (LOG X 10)) in
SUMEVENFIBS with (CEILING (/ (INTEGERLENGTH X) (LOG 10d0 2d0))).
That should run without overflow on CLISP.
But note that the latter formula doesn't always give *quite* the
same results, e.g., (sumevenfibs 100000) ==> 20899 as before, but
(sumevenfibs 200000) ==> 41798, one more than before. At the cost
of a little more runtime (~0.1 s more, on CMUCL), you can get a
better count of "digits" with (LENGTH (FORMAT NIL "~d" X)), which
once again gives 20899 & 41797, respectively.
Rob

Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)5722607