From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 96ce9b53 for ; Sat, 19 Oct 2019 00:58:26 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 6A7809B6BC; Sat, 19 Oct 2019 10:58:25 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 36AF69B57F; Sat, 19 Oct 2019 10:58:06 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tg2QgPVP"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 4D4B49B57F; Sat, 19 Oct 2019 10:58:03 +1000 (AEST) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by minnie.tuhs.org (Postfix) with ESMTPS id 5AD4E9B553 for ; Sat, 19 Oct 2019 10:58:02 +1000 (AEST) Received: by mail-pl1-f172.google.com with SMTP id j11so3650858plk.3 for ; Fri, 18 Oct 2019 17:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ajp22SsbLpeBF5nqgw84TM+CGYJuZlTneKQgFB/l6ps=; b=tg2QgPVPhX7uDGtbwWzzMx1IOG8hw/icQtt24KZZ2kjWU/zKIsShiC0eE3hl1T8uip fdrxOKzjAbgTgSp0yCqxQZOSWLLARzZWhVZWKgGh5HVkKdh+U+Ujdja7nKFsupsEVG7K NZJY4lQRqrYWn4GSUW3NYTDRcpHSFZZKDiMKLppGiwgev0Pg6j+PjokOQAUhHps3dgFf hB9hpQ9CQGuO80qMCv0SpGkWddOhmozi52yRFoTGg28hE52YNuNEmq2M61l1BYzUCMxr gX14WyEylxXYgKnPbfSAfdJdrGG0Qs3uFAYiYw7htpTjNgkut8h1wEr0+dTblPmBp9Ec cyuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ajp22SsbLpeBF5nqgw84TM+CGYJuZlTneKQgFB/l6ps=; b=WsOogRVg/ZbM4nI5sbTQJdJwD1/90G0wuRG/RERo4f+Zr5xNe2uJZ7YyjqZT3oWbWy PwZ0DE8nzTQQ4aj4yECfP5XP8MYpwA+IzUxE1Biqilgb5IBGn96X+d5GRdTGnqQGm+cy jQGtbslYg2PXgnzTCHUgAuLXfCHlTzs0WjZ34f8No8zZirwsYNf0tu6p5IemIglKXUm+ aZrfEdZSf8T+fXq+53KPN2q1Ste+VRe+r2oXckLV3uvXEAPu1T+RAqt9YAK2JPr3q0zd vLHvGpwxcVu4SeVY5q0OEMieFxvsb/BZbC4qOB4e5FPXdEpuiPA9Jav4Qo6QV0+sMPEC a1pg== X-Gm-Message-State: APjAAAW9zHZFrPNAyblHx9+bEgL4mhlYiC3Np+DaHDErhBR+gAQBKNBo 1G2J4qMhMlhob2VEjKgY4MLVy7pt X-Google-Smtp-Source: APXvYqyTnNGkiN7RNcebCzRKNnfFY/VTaXnXw1Q/+rJSDqIN77P6Pcg9OZfb5c5+RUiLD2a1YWqXLw== X-Received: by 2002:a17:902:8c98:: with SMTP id t24mr12685182plo.334.1571446681316; Fri, 18 Oct 2019 17:58:01 -0700 (PDT) Received: from localhost.localdomain ([1.144.231.150]) by smtp.gmail.com with ESMTPSA id 127sm10107567pfw.6.2019.10.18.17.57.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 17:57:59 -0700 (PDT) Date: Sat, 19 Oct 2019 11:57:55 +1100 From: "G. Branden Robinson" To: tuhs@minnie.tuhs.org Message-ID: <20191019005752.3r7srxe73v47rtuy@localhost.localdomain> References: <201910181152.x9IBq95P001809@coolidge.cs.Dartmouth.EDU> <20191018183610.diq_a%steffen@sdaoden.eu> <9053c41b-e306-8547-50fd-207e0bfb49af@kilonet.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wj36r6gtxjbjxnii" Content-Disposition: inline In-Reply-To: <9053c41b-e306-8547-50fd-207e0bfb49af@kilonet.net> User-Agent: NeoMutt/20180716 Subject: Re: [TUHS] Space Travel, was New: The Earliest UNIX Code X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --wj36r6gtxjbjxnii Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable At 2019-10-18T19:20:35-0400, Arthur Krewat wrote: > I didn't have an 8087 floating point accelerator, so I wrote my > assembler example to use two 16-bit words of integers, combining them > for a 31-bit integer value with sign. >=20 > Now mind you, the C version used real floating point, and a software > floating point library with no hardware accelerator. At that point, I > realized C was the way to go. It had passed my experiment with flying > colors. The C compiler, I believe, was from Computer Innovations, > Copyright (c)1981,82,83,84,85 >=20 > The reason this is similar to Ken's statement above: In the assembler > version, the cube would deform quite a bit before the run would > finish. A 31-bit integer didn't accurately reflect the result of the > math. Over time, that slight inaccuracy really added up. The accuracy > of the C version using floats was spot on.=A0 So while I basically > cheated for the assembler version, causing the deformation of the cube > over time, the C version was 100% accurate even though it was slower. >=20 > I wonder, is there something inherently different between PDP-11/7 > floats and Intel's leading to the inaccuracy Ken mentions? Was the > PDP-11 (or the -7) floating point that much different than IEEE-754 ? It sounds like it could be a simple matter of precision to me. It takes 32 bits to store a single-precision floating point value. Double-precision requires 64. In IEEE 754, the significand is 53 bits (52 bits plus the implicit leading 1). I can never remember the C type promotion rules without looking them up, but IIRC at least in some circumstances C promotes floats to doubles, at least for intermediate results. And the software floating-point library you used could well have done the same, or perhaps it used doubles all the way internally. Either of these could have prevented accumulated roundoff. I've heard, with a level of conviction somewhere between folklore and formal demonstration[1], that for many practical numerical problems, single-precision is just not quite good enough, but double-precision is ample. Somewhere between 24 and 53 bits of significant, perhaps, there is a sweet spot. The wisdom I've absorbed is, if you have to do floating-point, use doubles, unless you can clearly and convincingly articulate why you absolutely need more precision, or can get away with less. (For same 3D game-rendering applications, half-precision is adequate.) A non-quantified "single-precision will be faster" declaration should be understood to include a lot of "!!1!11" punctuation after it, and such people should be handled as delicately as any other Gentoo user. Regards, Branden [1] Example: Ben Klemens, _21st-Century C_, O'Reilly. --wj36r6gtxjbjxnii Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEh3PWHWjjDgcrENwa0Z6cfXEmbc4FAl2qX4gACgkQ0Z6cfXEm bc7s0g/+J9RA7/YBBlJVmolud/wragLiszjtp1lcTQABuq+4AEGhddu734DtPLeH XKeZlAiNVRhRSqVpiki51yzxIIyJ3GA9RvMqCOLMnr10optqUCHL9JrzCJrYt4GM QY4CJaMHg8qqtosKFG5D6spNeuADk1owdj1v9LTy0c43lnImtrHlq2GYC6fI6OUE ioXRg86uDyyBJWhn1lNXL7SYe1V+uddguyfWSK1BO6Dkt9LWqOn9D6gDAOnuz3tH uXwGF5Z5gZzmlt0OnsbPRks7csohrq1ir72FDi2jp7/TX3upphMpFcn+hpG+aGmj anAiA0fj7QL+2NSKuQx5a7bKHS/OAxLSkZke+AjU5R+3eGtGB/jOJPBLOF2VnUxW WgxRnWNwU75WZYfTHxrT5ipJrZJxvLGKIn/e7WHtIb2Ba0FzCbVur7+ZRpuCBZLd PHezH1px1/QF6lYXuptpiUKDtqVwWXgvNn1a5Re3Ul7IbkywSTKg3fkZb5/JWDmo bUdwCYtbGHYwe3vMl6pj2iLS/Za+zLbOp4+PfxhfRZTbX6CpMf1BEvG9/PSyORuv JcWlGx2zBDUCiW2I+q3Gc4+fYpCdJXsGEaj6QyS0SV58LwpVmgKRblP8Z5p4ISCe 8BLuSSY1yIaC4C1MWm3BdmJl8HoYxnfgCTJjpuF8SwuBaW0IOMo= =uo2z -----END PGP SIGNATURE----- --wj36r6gtxjbjxnii--