From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 25911 invoked from network); 29 Jul 1999 16:38:43 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 29 Jul 1999 16:38:43 -0000 Received: from paralleldata.com (smtp.paralleldata.com [38.153.145.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id MAA06763 for ; Thu, 29 Jul 1999 12:38:40 -0400 Received: by paralleldata.com from localhost (router,SLMail V2.5); Thu, 29 Jul 1999 11:43:09 -0500 Received: by paralleldata.com from paralleldata.com (207.136.50.228::mail daemon; unverified,SLMail V2.5); Thu, 29 Jul 1999 11:43:07 -0500 Sender: "Wsb" Message-ID: <37A083B0.8B46CEFD@paralleldata.com> Date: Thu, 29 Jul 1999 11:39:12 -0500 From: "Wes Bauske" Organization: PDS Inc. X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i686) X-Accept-Language: en MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: Float Pt Precision References: <37A055F8.F9CEC671@voicenet.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Uncle George wrote: > > Been trying to determine why the double's between an Intel Box & and > Alpha box are different on postgresql. > > The algoritms: > 1a) t1.q = result.A * pt1.x; > 1b) t2.q = pt1.y - t1.q; > > and > > 2) t3.q = result.C = pt1.y - result.A * pt1.x; > > will produce the same results on the Alpha 0x402ec4ec4ec4ec50, > but will produce different results in the intel 0x402ec4ec4ec4ec50, > 0x402ec4ec4ec4ec54 > That means the Alpha follows the IEEE rules well compared to the Intel. Anyway, never do bit compares with FP results. It's a waste of your time. Only look at the magnitude of the difference. In my types of code, I look at how many DB down the difference is to decide if it's the same answer. Lots of things can effect how the answer turns out. Order of calculation and optimizations quite commonly change the answer slightly. Either you want performance and take a non-bit level identical answers between machine types, or you end up with poor performing code that might get the same results if you enforce IEEE 64 bit arithmetic. As long as your algorithm is not sensitive to low bit errors you'll be fine. In other words you don't subtract almost exactly the same numbers from each other. (finite differences) If you do, then you need to worry about numerical viscosity and how the HW rounds it's answers. Keep in mind, FP representation is an approximation to the mathmetically correct answer when the exponent gets larger anyway. Wes