Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!hc!beta!a!jlg From: jlg@a.UUCP (Jim Giles) Newsgroups: comp.arch Subject: Re: Yet another dumb question Message-ID: <559@a.UUCP> Date: 6 Apr 88 09:10:30 GMT Distribution: na Organization: Los Alamos Natl Lab, Los Alamos, N.M. Lines: 52 Keywords: Floating point, condition codes To make my first question more clear, consider the following description of the subtract and jump instructions of a hypothetical machine: Let A and B be floating point numbers. Then the subtract operation has the following results. (NUM is an in-range number, NAN is a not-a-number, INF is plus or minus infinity.) A +/-INF NAN NUM |---------------------- +/-INF|NAN NAN -/+INF |---------------------- B NAN|NAN NAN NAN |---------------------- NUM|+/-INF NAN NUM Further, if A and B are both NUM but the subtract overflows, the result is the properly signed INF. The Jump instructions are as follows (each tests the contents of a register R) JNZ R,ADDR Jump to ADDR if R is non-zero NUM or INF. Don't jump if R is zero or NAN. JZ R,ADDR Jump to ADDR if R is zero. Don't jump otherwise. JP R,ADDR Jump to ADDR if R is positive NUM, +INF, or zero. Don't jump if R is NAN or negative. JNEG R,ADDR Jump to ADDR if R is negative NUM or -INF. Dont jump otherwise. JUN R,ADDR Jump to ADDR if R is NAN. Don't jump otherwise. At a high level, it is now possible to test for >, <, ==, >=, <=, <>, and unordered. Does this description fulfill the requirements of the IEEE floating point standard? My interest is in the design of a RISC machine, so I don't want to introduce a compare instruction unnecessarily. I also don't want to introduce condition codes if I can avoid it. Note, I have assumed that infinities are unordered - is there still an affine vs. projective mode? Should infinity compare equal to itself? J. Giles Los Alamos