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 SAA24374 for caml-redistribution; Mon, 6 Sep 1999 18:18:47 +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 BAA14523 for ; Mon, 6 Sep 1999 01:53:22 +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 BAA06592 for ; Mon, 6 Sep 1999 01:53:19 +0200 (MET DST) Received: from dylan (dialup12ip063.tus.azstarnet.com [169.197.35.191]) by cepheus.azstarnet.com (8.9.3/8.9.3) with SMTP id QAA13455 for ; Sun, 5 Sep 1999 16:53:11 -0700 (MST) X-Sent-via: StarNet http://www.azstarnet.com/ Message-ID: <000301bef7f9$d8583790$210148bf@dylan> From: "David McClain" To: Subject: A way to restore sanity to IEEE FP math. Date: Sun, 5 Sep 1999 16:52:48 -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 All the recent difficulties I've had with IEEE FP math can be traced to the bipolar nature of zero. Direct use of this means that although the two compare as equal, they cause a situation where subtraction is no longer anitcommutative. They manifest this difficulty most in complex arithmetic when the function atan2 is used to compute the phase angle of a complex number. I recommend, instead, that complex arithmetic use the function phase, defined as, phase re im = atan2 (im +. 0.0) (re +. 0.0) Doing so preserves the affine infinities, and preserves the use of bipolar zero for those who need it, but restores the sanity of our number system in the complex plane. The phase angle of (-1, 0-) and (-1, 0+) are thus on the same Riemann sheet, addition retains its cummutative behavior, negation is still idempotent, and subtraction is restored to anticommutativity. The only way to detect which zero one might have is through the use of the curious function atan2, which allows one to see ever so slightly beyond one Riemann sheet by peeking under the principal sheet along the branch cut on the negative real axis. But since this is a curious function, and since complex arithmetic now uses phase to obtain its angles, we have a sensible system. Furthermore, the old identities (a + 0) = a are restored, as well as (0 - a) = -a. Hence the kinds of quick simplifications one is tempted to do are okay and will not violate the arithmetic. Our faith can be restored in FP math, and branch cuts are all properly preserved regardless of the number and kind of quick simplifications we might be tempted to perform during translation from algebra to computer code. Those needing the bipolar zeros for interval arithmetic and for detecting the sense of arithmetic rounding are still able to achieve their goals, by means of the atan2 function. - DM