From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,HTML_FONT_LOW_CONTRAST,HTML_MESSAGE, MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from minnie.tuhs.org (minnie.tuhs.org [50.116.15.146]) by inbox.vuxu.org (Postfix) with ESMTP id D4CAF29511 for ; Wed, 13 Mar 2024 21:35:19 +0100 (CET) Received: from minnie.tuhs.org (localhost [IPv6:::1]) by minnie.tuhs.org (Postfix) with ESMTP id 46EB442804; Thu, 14 Mar 2024 06:35:14 +1000 (AEST) Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by minnie.tuhs.org (Postfix) with ESMTPS id 7DD27427F7 for ; Thu, 14 Mar 2024 06:35:05 +1000 (AEST) Received: by mail-vk1-xa29.google.com with SMTP id 71dfb90a1353d-4d40efbcb07so68853e0c.2 for ; Wed, 13 Mar 2024 13:35:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccc.com; s=google; t=1710362104; x=1710966904; darn=tuhs.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+JlOjAzUC7cxusJyGQaGGOSHDpRMu7PzTOPNN9lfWeA=; b=iwQeKPQeP6R0ypbFzX7G+aOPtX1oSlBV3gzdqBRsEp45nrnaxbDe54iIRBl+bxldKm OOjkd5U2WB1gSMnZvJ8P+gFl1CU4f+v+PsQiG/DUVScWThlTK9FCxUKNfz/+4Ms0rDDo 0MgYt6NmWNnIKpYITtqAx/pU9l4elqgCbC1SM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710362104; x=1710966904; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+JlOjAzUC7cxusJyGQaGGOSHDpRMu7PzTOPNN9lfWeA=; b=f9MQuEIs5V7n6YL8GYcuKFxAlWa35YGQRfgJGYzqZ+wK36ZK1P0foHSuIVOTMZRTVw onm/3LYQkKKSz2GEQLqkgPu/D8Dr9MDVf/HNDib7DW2fYmcC8ExKY/+kLmExt0unsjX3 H5W+wF8S4N+kXqE45ilQWwZvpHP9fKJfa/eyyRUv09dHOYEiAsfg0bJj4qWNYlwapYAs 9YVBy4HrN7TznPBSpjL2+t2gZ+sxnsg3kIN/iNy3/7u3c66AAbSr19qQX7R35veHVJTs IglNp7sghNOOViz4pBb1oRhU18rET5gs+MHe5ueLxI/WfljawOX41sRZiF3HaoBlKdgS e8Lw== X-Forwarded-Encrypted: i=1; AJvYcCW2+d6Olrxqw26MwoYp1jJ7yU05th1dg9O3shZOr/LoQ/9TdhLmYz9MKMtXw296Q53pX/kCncey8XfSfUEC X-Gm-Message-State: AOJu0Yyz8yEJmdjn61SuOR83idWm1qRu8CF5mq3dV6VIKB0yFbzNKTWU EaEpqAOdFcVlsItzHU4IBB89tQ29RRXZQlDGSANOYgsGUdiIdSAlcNBL1F3/tOH8Fau+g1ke54M sKHeO/z6u7qTtq3WmDYEnQ1+CiSVPdjbA0OO9 X-Google-Smtp-Source: AGHT+IH+X2WKOE2W6rwtbKufdmg98zBekDf/unfZVDi4WvOfolgMVlz18+FWprNo+8tNRM/UnHsGTVq4jwUuOqPXfv4= X-Received: by 2002:a05:6122:2514:b0:4d4:1551:6ef6 with SMTP id cl20-20020a056122251400b004d415516ef6mr86539vkb.2.1710362103929; Wed, 13 Mar 2024 13:35:03 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Clem Cole Date: Wed, 13 Mar 2024 16:34:27 -0400 Message-ID: To: Rob Pike Content-Type: multipart/alternative; boundary="000000000000a4801b061390b55a" Message-ID-Hash: PDLXSQLJQV7UQBMJQK26CW2R5T7WMF2A X-Message-ID-Hash: PDLXSQLJQV7UQBMJQK26CW2R5T7WMF2A X-MailFrom: clemc@ccc.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Jonathan Gray , Russ Cox , tuhs@tuhs.org X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [TUHS] Re: early unix rand List-Id: The Unix Heritage Society mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --000000000000a4801b061390b55a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Prof Kahan's Floating Point Test Program - the original from his and his students in his computer arithmetic seminar wrote during my days at UCB: https://www.netlib.org/paranoia/ Kahan was always miffed at how bad the different floating point units were - (Seymour was notorious for being fast but not very precise on most of his FP units). Here is an updated FORTRAN 90 version: https://people.math.sc.edu/Burkardt/f_src/paranoia/paranoia.html =E1=90=A7 On Wed, Mar 13, 2024 at 4:25=E2=80=AFPM Rob Pike wrote: > Norm Schryer wrote a (nearly?) exhaustive floating-point tester that he > ran when a new CPU arrived, always with wrong results. Doug McIlroy > probably knows more about it than I do, who only observed it from afar. > > -rob > > > On Thu, Mar 14, 2024 at 4:18=E2=80=AFAM ron minnich = wrote: > >> Got the name wrong: Computer Engineering: A DEC View of Hardware Systems >> Design >> >> On Wed, Mar 13, 2024 at 9:41=E2=80=AFAM ron minnich = wrote: >> >>> by the way, I realize that random number urban legend sounds ridiculous= , >>> in light of how hardware design is done today, but those of you who did >>> hardware design in those days (guilty!), and had access to -11 >>> schematics and boards, might wonder if it's not possible. There was a >>> habit, in those days, for performance reasons, of subbing transparent >>> latches for flip-flops to gain a little time. An engineer I knew at Amd= ahl >>> said that was a pretty hot topic there. Certainly, the technique of des= ign >>> for testability was not really in wide use in the -11 days. Gordon Bell= 's >>> book "Computer Design" is particularly instructive. >>> >>> E.g., how did you verify the floating point on your new machine? Put an >>> older machine next to a new machine, do lots of computation, see if the= re >>> is disagreement, you've found a bug in the new machine, right? Maybe. >>> Sometimes, you discover the older machine had a bug the newer one did = not >>> ... happened more than once, including on the 360 to 370 transition. >>> >>> On Tue, Mar 12, 2024 at 6:09=E2=80=AFPM ron minnich wrote: >>> >>>> There used to be an urban legend about multiply overflow and the PDP 1= 1. >>>> >>>> This would=E2=80=99ve been circa 1976. Someone from DEC told us that o= n a >>>> multiply overflow, the contents of the destination register would be = =E2=80=9Ckind >>>> of=E2=80=9D random. I was never able to verify that claim. But that mi= ght explain >>>> this code. >>>> >>>> On Tue, Mar 12, 2024 at 16:05 Jonathan Gray wrote: >>>> >>>>> On Tue, Mar 12, 2024 at 08:55:02AM -0400, Russ Cox wrote: >>>>> > Hi all (and TUHS), >>>>> > >>>>> > The Third Edition rand(III) page [1] ends with >>>>> > >>>>> > WARNING The author of this routine has been writing >>>>> > random-number generators for many years and has >>>>> > never been known to write one that worked. >>>>> > >>>>> > My understanding is that Ken wrote the rand implementation. >>>>> > But I'm curious about the origin of this warning. >>>>> > I had assumed that Ken wrote it as a combination warning+joke, >>>>> > but Rob suggested that to him it didn't sound like Ken and >>>>> > perhaps Doug or Dennis had written it. Does anyone remember? >>>>> > >>>>> > Separately, I am trying to find out what the very first >>>>> > Unix rand implementation was. In the TUHS archives, >>>>> > the incomplete V2 sources contain a reference to srand >>>>> > in cmd/bas0.s [2], but there is no definition in the tree. >>>>> > The V3 man pages list it, but as far as I can tell full >>>>> > library sources do not appear in the TUHS archives >>>>> > until the V6 snapshot. The V6 rand [3] is: >>>>> > >>>>> > rand: >>>>> > mov r1,-(sp) >>>>> > mov ranx,r1 >>>>> > mpy $13077.,r1 >>>>> > add $6925.,r1 >>>>> > mov r1,r0 >>>>> > mov r0,ranx >>>>> > bic $100000,r0 >>>>> > mov (sp)+,r1 >>>>> > rts pc >>>>> >>>>> matches V5: >>>>> https://www.tuhs.org/cgi-bin/utree.pl?file=3DV5/usr/source/s3/rand.s >>>>> Distributions/Research/Dennis_v5/v5root.tar.gz >>>>> >>>>> >>>>> > >>>>> > Perhaps this is the original rand as well? It is hard to imagine >>>>> > a much simpler one, other than perhaps removing the addition, >>>>> > but doing so would create a sequence of only odd numbers. >>>>> > >From the man page description it sounds like this has to be the >>>>> > original generator, perhaps with different constants. >>>>> > >>>>> > Thanks! >>>>> > >>>>> > Best, >>>>> > Russ >>>>> > >>>>> > [1] >>>>> > >>>>> https://github.com/dspinellis/unix-history-repo/blob/Research-V3/man/= man3/rand.3 >>>>> > [2] >>>>> > >>>>> https://github.com/dspinellis/unix-history-repo/blob/Research-V2/cmd/= bas0.s >>>>> > [3] >>>>> > >>>>> https://github.com/dspinellis/unix-history-repo/blob/Research-V6/usr/= source/s3/rand.s >>>>> >>>> --000000000000a4801b061390b55a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Prof Kahan's Floating Point Test Program - the orig= inal from his and his students in his computer arithmetic seminar wrote dur= ing my days at UCB: https://ww= w.netlib.org/paranoia/
Kahan was always miffed at how bad the = different floating point units were - (Seymour was notorious for being fast= but not very precise on most of his FP units).
Here is an updated = FORTRAN 90 version:=C2=A0https://people.math.sc.edu/Burkardt/f_src/parano= ia/paranoia.html
3D""= =E1=90=A7

On Wed, Mar 13, 2024 at = 4:25=E2=80=AFPM Rob Pike <robpike@g= mail.com> wrote:
Norm Schryer wrote a (nearly?) exhaustive floating-point = tester that he ran when a new CPU arrived, always with wrong results. Doug = McIlroy probably knows more about it than I do, who only observed it from a= far.

-rob



by the way, I realize that random number urban legend= sounds ridiculous, in light=C2=A0of how hardware design is done today, but= those of you who did hardware design in those days (guilty!), and had acce= ss to -11 schematics=C2=A0and boards, might=C2=A0wonder if it's not pos= sible. There was a habit, in those days,=C2=A0 for performance reasons, of = subbing transparent latches for flip-flops to gain a little time. An engine= er I knew at Amdahl said that was a pretty hot topic there. Certainly, the = technique of design for testability was not really in wide use in the -11 d= ays. Gordon Bell's book "Computer Design" is particularly=C2= =A0instructive.=C2=A0

E.g., how did you verify the float= ing point on your new machine? Put an older machine next to a new machine, = do lots of computation, see if there is disagreement, you've found a bu= g in the new machine, right? Maybe. Sometimes,=C2=A0 you discover=C2=A0the = older machine had a bug the newer one did not ... happened=C2=A0more than o= nce, including on the 360 to 370 transition.

On Tue, Mar 12, 2024 at 6= :09=E2=80=AFPM ron minnich <rminnich@gmail.com> wrote:
There used to be an urban l= egend about multiply overflow and the PDP 11.

This would=E2=80=99ve been circa 1976. Someone from D= EC told us that on a multiply overflow, the contents of the destination reg= ister would be =E2=80=9Ckind of=E2=80=9D random. I was never able to verify= that claim. But that might explain this code.=C2=A0

On Tue, Mar 12, 20= 24 at 16:05 Jonathan Gray <jsg@jsg.id.au> wrote:
On Tue, Mar 12, 2024 at 08:55:02AM -0400, Russ Cox wrote= :
> Hi all (and TUHS),
>
> The Third Edition rand(III) page [1] ends with
>
> WARNING=C2=A0 The author of this routine has been writing
>=C2=A0 =C2=A0 =C2=A0random-number generators for many years and has
>=C2=A0 =C2=A0 =C2=A0never been known to write one that worked.
>
> My understanding is that Ken wrote the rand implementation.
> But I'm curious about the origin of this warning.
> I had assumed that Ken wrote it as a combination warning+joke,
> but Rob suggested that to him it didn't sound like Ken and
> perhaps Doug or Dennis had written it. Does anyone remember?
>
> Separately, I am trying to find out what the very first
> Unix rand implementation was. In the TUHS archives,
> the incomplete V2 sources contain a reference to srand
> in cmd/bas0.s [2], but there is no definition in the tree.
> The V3 man pages list it, but as far as I can tell full
> library sources do not appear in the TUHS archives
> until the V6 snapshot. The V6 rand [3] is:
>
> rand:
>=C2=A0 =C2=A0 =C2=A0mov r1,-(sp)
>=C2=A0 =C2=A0 =C2=A0mov ranx,r1
>=C2=A0 =C2=A0 =C2=A0mpy $13077.,r1
>=C2=A0 =C2=A0 =C2=A0add $6925.,r1
>=C2=A0 =C2=A0 =C2=A0mov r1,r0
>=C2=A0 =C2=A0 =C2=A0mov r0,ranx
>=C2=A0 =C2=A0 =C2=A0bic $100000,r0
>=C2=A0 =C2=A0 =C2=A0mov (sp)+,r1
>=C2=A0 =C2=A0 =C2=A0rts pc

matches V5:
https://www.tuhs.org/cgi-bin/utree.pl?file=3DV5/usr/source/s3= /rand.s
Distributions/Research/Dennis_v5/v5root.tar.gz


>
> Perhaps this is the original rand as well? It is hard to imagine
> a much simpler one, other than perhaps removing the addition,
> but doing so would create a sequence of only odd numbers.
> >From the man page description it sounds like this has to be the > original generator, perhaps with different constants.
>
> Thanks!
>
> Best,
> Russ
>
> [1]
> https://github.= com/dspinellis/unix-history-repo/blob/Research-V3/man/man3/rand.3
> [2]
> https://github.com/d= spinellis/unix-history-repo/blob/Research-V2/cmd/bas0.s
> [3]
> https://gi= thub.com/dspinellis/unix-history-repo/blob/Research-V6/usr/source/s3/rand.s=
--000000000000a4801b061390b55a--