Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!inuxc!pur-ee!uiucdcs!parsec!wallach
From: wallach@parsec.UUCP
Newsgroups: net.arch
Subject: Re: Re: Complement Arithmetic - (nf)
Message-ID: <5354@uiucdcs.UUCP>
Date: Fri, 3-Feb-84 23:24:47 EST
Article-I.D.: uiucdcs.5354
Posted: Fri Feb  3 23:24:47 1984
Date-Received: Wed, 8-Feb-84 05:41:21 EST
Lines: 34

#R:burdvax:-142500:parsec:32800004:000:1498
parsec!wallach    Feb  3 15:04:00 1984

i did not realize that an off-the-cuff remark would generate this type
of response. some comments on the subject

1)dividing by 2 on 2's complement works.  the shift right algorithm is
a)test for negative, b)if negative take the 2's complement and then
right shift, and then take the 2's complement of the answer.  thus
the 2's complement of binary (1111 1111) (i.e, -1 base 10) is 0
as contrasted to 1111 1111 with a simple signed right shift

2)the relative speed of arithmetics on all these algorithms is a
function of the arithmetic used.  adds and subtracts are nice using
2's complement  while multiply and divide are nice using sign and
magnitude.

3)the two zero representation of sign and magnitude and 1's can
however produce curious side effects. if an add of 1 to negative -1
produces -0 as opposed to +0 and the compare or whatever instructions
do not anticpate this, then bugs will occur.  this occurred to be
using an algol compiler on the 7040 way back when.  if one had the
statement if n = 0 and n was initially negative and incrementing
unusual side effects occurred.  the fix was to replace the if with
if n+1 = 1.

4)the extra negative representatin of 2's really screws things up when
you do fix to float and float to fix.  since float is sign and
magnitude.

5)leaving with this observation why is  ieee  float sign and magnitude
and fix is 2's.  why shouldn't the float standard use the same number
representation as the standard (be it defacto) fixed point
representaion?