The Pentium Non-Bug

From: David McClain (dmcclain@azstarnet.com)
Date: Fri Sep 03 1999 - 23:41:20 MET DST


From: "David McClain" <dmcclain@azstarnet.com>
To: <caml-list@inria.fr>
Subject: The Pentium Non-Bug
Date: Fri, 3 Sep 1999 14:41:20 -0700

In light of my recent trip around the mulberry bush, I thought I would post
a preamble from some of my code for everyone's sake.

- DM

(* ------------------------------------------------------------ *)
(* Considerable care has been taken to be IEEE correct *)
(* in the face of distinct (+0.0) and (-0.0). *)

(* The rules of the game are: *)

(* Addition => commutative a + b = b + a *)
(* Subtraction => anticommutative a - b = -(b - a) *)
(* Multiplication => commutative a * b = b * a *)
(* Division => inverse-commutative a / b = 1.0 / (b / a) *)

(* Identity under addition: *)
(* x + (-0.0) = x but x + (+0.0) != x *)

(* Identity under subtraction: *)
(* x - (+0.0) = x but x - (-0.0) != x *)

(* Negation by subtraction: *)
(* (-0.0) - x = neg x (= FCHS x) but (+0.0) - x != neg x *)

(* Equivalence of subtraction by addition of negative: *)
(* a - b = a + neg b *)

(* Distribution of negation: *)
(* a - b = -(b - a) = -b - (-a) = -b + a *)
(* ;; remember that addition is commutative *)

(* Complex conjugation by negation: *)
(* conj(re,im) = (re, -im) != (re, 0 - im) *)

(* Since the constant 0.0 generally denotes (+0.0) and since it is *)
(* generally difficult to determine the sign of a given *)
(* zero constant value, one simply cannot assume that: *)
(* 0.0 + x = x *)
(* x - 0.0 = x *)
(* 0.0 - x = neg x *)
(* Rather, one must carry out what appears to be a null operation, *)
(* and be certain to negate when appropriate, instead of subtracting *)
(* from zero. *)



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:25 MET