Thanks.

This is weird.  The C and Fortran versions seem to agree.

Marco




On Thu, Nov 9, 2023 at 9:49 PM Frank Gönninger | Gönninger B&T <frank.goenninger@goenninger.net> wrote:

Hi Marco,

 

on AllegroCL 11.0 beta Enterprise Edition I get diverging results starting at j = 21…

 

Lisp: j = 21; ss = 0.00028959847986698150

C:      j = 21; ss = 0.00028959847986698151

 

FWIW …

 

Best,

   Frank

 

Von: <owner-lisp-hug@lispworks.com> im Auftrag von "Marco Antoniotti (as marco dot antoniotti at unimib dot it)" <lisp-hug@lispworks.com>
Antworten an: Marco Antoniotti <marco.antoniotti@unimib.it>
Datum: Donnerstag, 9. November 2023 um 21:23
An: LispWorks <lisp-hug@lispworks.com>, Discussion list for Common Lisp professionals <pro@common-lisp.net>
Betreff: Help with bit bashing code: differences between C and CL

 

Dear all,

 

I am hitting a wall with the attached code in CL and C versions.  For those interested, this is code lifted from Knuth's pages on random number generation (https://www-cs-faculty.stanford.edu/~knuth/programs.html#rng).

The problem is that there is a discrepancy in the "problem" loop between the CL and the C and I cannot figure out why, although the culprit may be that CL does not have "proper" 64 bits ints.

I am running on LW 8.x on an Intel Mac.  I have not tried on other CL implementations/platforms. I compile the C code with clang (Apple clang version 15.0.0 (clang-1500.0.40.1)

 

If you run the code, you will see that the discrepancy appears at 'j = 14' in the loop.

 

What gives?

Thanks

Marco

 

 


--

Marco Antoniotti, Professor                  tel. +39 - 02 64 48 79 01
DISCo, Università Milano Bicocca U14 2043    http://dcb.disco.unimib.it
Viale Sarca 336
I-20126 Milan (MI) ITALY