From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA09828 for caml-redistribution; Mon, 6 Sep 1999 10:25:45 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA12611 for ; Fri, 3 Sep 1999 20:17:33 +0200 (MET DST) Received: from cepheus.azstarnet.com (cepheus.azstarnet.com [169.197.56.195]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id UAA25115 for ; Fri, 3 Sep 1999 20:17:31 +0200 (MET DST) Received: from dylan (dialup03ip024.tus.azstarnet.com [169.197.31.24]) by cepheus.azstarnet.com (8.9.3/8.9.3) with SMTP id LAA23817 for ; Fri, 3 Sep 1999 11:17:28 -0700 (MST) X-Sent-via: StarNet http://www.azstarnet.com/ Message-ID: <000e01bef638$98d32b10$210148bf@dylan> From: "David McClain" To: Subject: Correct interpretation of the Pentium non-bug Date: Fri, 3 Sep 1999 11:17:33 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: weis Something Xavier showed got me thinking and I ran some more tests this morning. It turns out that the problem previously reported actually has nothing to do with FCHS vs FSUB. Rather, it has to do with how one adds a real value to a complex value, especially when the complex value has a IEEE(-0.0) imaginary component. Adding a real to a complex number: a + (bre, bim) != (a+bre, bim) rather a + (bre, bim) == (a + bre, (+0.0) + bim) This matters only when bim is (-0.0) because, FPADD (+0.0) (+0.0) = +0.0 FPADD (+0.0) (-0.0) = +0.0 (!!!) FAPDD (+0.0) x = x (for all other x) When this is properly handled, the routines all give the correct branch cut behavior. It turns out that, indeed, I*(are, aim) = (- aim, are) where the negative sign is FCHS, instead of (0.0 - aim, are). The second form is incorrect. While all very esoteric and nit-picking, it does show the importance in compiler writing of being very careful during constant-folding and strength-reduction phases of optimization. I am probably guilty, years ago, of assuming that 0.0 + anything => anything, in my old C compilers. This subtle fact simply isn't true in IEEE FP. - DM