From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 109d8a,232e89dd4cc3c154 X-Google-NewGroupId: yes X-Google-Thread: 1014db,232e89dd4cc3c154 X-Google-NewGroupId: yes X-Google-Thread: 1094ba,232e89dd4cc3c154 X-Google-NewGroupId: yes X-Google-Thread: 101deb,dea70f96af442ea2 X-Google-NewGroupId: yes X-Google-Thread: 103376,232e89dd4cc3c154 X-Google-NewGroupId: yes X-Google-Attributes: gid9ef9b79ae9,gid4516fb5702,gid8d3408f8c3,gidbda4de328f,gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!2a01:348:65::2.MISMATCH!news-transit.tcx.org.uk!nntp-feed.chiark.greenend.org.uk!ewrotcd!not-for-mail From: nmm1@cam.ac.uk Newsgroups: sci.math,comp.lang.c,comp.lang.fortran,comp.lang.pl1,comp.lang.ada Subject: Re: KISS4691, a potentially top-ranked RNG. Date: Mon, 2 May 2011 08:31:20 +0100 (BST) Organization: Department of Deniable Assertions Sender: nmm@gosset.csi.cam.ac.uk Message-ID: References: <4dae2a4b$0$55577$c30e37c6@exi-reader.telstra.net> <4dbd6e9c$0$12957$892e0abb@auth.newsreader.octanews.com> <925saiFj03U7@mid.individual.net> <4dbe2304$0$12961$892e0abb@auth.newsreader.octanews.com> Reply-To: nmm1@cam.ac.uk NNTP-Posting-Host: chiark.greenend.org.uk X-Trace: chiark.greenend.org.uk 1304323781 8962 212.13.197.229 (2 May 2011 08:09:41 GMT) X-Complaints-To: abuse@chiark.greenend.org.uk NNTP-Posting-Date: Mon, 2 May 2011 08:09:41 +0000 (UTC) Originator: @gosset.csi.cam.ac.uk ([131.111.10.32]) Xref: g2news2.google.com sci.math:234644 comp.lang.c:126735 comp.lang.fortran:41567 comp.lang.pl1:2455 comp.lang.ada:20092 Date: 2011-05-02T08:31:20+01:00 List-Id: In article <4dbe2304$0$12961$892e0abb@auth.newsreader.octanews.com>, Thad Smith wrote: >On 5/1/2011 12:58 PM, Ian Collins wrote: >> On 05/ 2/11 03:31 AM, Thad Smith wrote: >>> >>> Here is a modification of the program with masking to produce correct results >>> with any conforming C implementation. It truncates where when required. A good >>> optimizer should eliminate the unneeded masking for 32-bit unsigned long. >> >> Why oh why can't people just use fixed width types? What's the obsession with >> unsigned long and masking? > >In my case, I work with a lot of compilers not supporting C99. The code is thus >more portable to existing applications. Standard C doesn't guarantee the >existence of a 32-bit integer type. As those of us with significant experience of portability will remember, building fixed sizes into a program is a cardinal error. Sooner or later, you will want to run that code on a system with different sizes, and it won't work. The vast majority of clean programs, even in C90, needed NO source changes to go from 32 to 64 bits; I have written code that was moved to systems with 16, 24, 32, 36, 48, 60, 64 and perhaps other sizes, and so have many other people. I accept that Marsaglia's generator is a valid case for using fixed-width types, but that is likely to make it very inefficient indeed on a system where they are not natural. Masking is a far more portably efficient approach. Regards, Nick Maclaren.