Subject: Re: SBCL lead me on...
From: rpw3@rpw3.org (Rob Warnock)
Date: Fri, 26 Sep 2008 20:14:45 -0500
Newsgroups: comp.lang.lisp
Message-ID: <y9GdnY0GRYGYFEDVnZ2dnUVZ_r7inZ2d@speakeasy.net>
Raymond Toy  <raymond.toy@ericsson.com> wrote:
+---------------
| >>>>> "Bob" == Bob Felts <wrf3@stablecross.com> writes:
| Bob> SBCL (1.0.19.26, Mac OS X) says that
| Bob>    (log (loop for n from 1 to 1000 for f = 1 then (* f n)
| Bob>              finally (return f))
| Bob>           10d0)
| Bob> is 2567.604_7_482272297
| 
| cmucl returns 2567.6046442221327d0.
+---------------

Is that something that changed after CMUCL-19c?

    cmu> (lisp-implementation-version)

    "19c Release (19C)"
    cmu> (log (loop for n from 1 to 1000 for f = 1 then (* f n)
		finally (return f))
	      10d0)

    2567.6047482272297d0
    cmu> 

Note that 19c does get an answer much closer to the one(s)
called "correct" if one sums the logs incrementally:

    cmu> (loop for n from 1 to 1000 summing (log n 10d0))

    2567.6046488768784d0
    cmu> 

but it's still different from yours. Finally, explicitly coercing
before the LOG gets still a third result, *almost* the same as
previously-posted "correct" answers:

    cmu> (loop for n from 1 to 1000
	   summing (log (coerce n 'double-float) 10d0))

    2567.60464422213d0
    cmu> 

???


-Rob

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