Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 12/4/83; site rlgvax.UUCP Path: utzoo!watmath!clyde!floyd!harpo!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.arch Subject: Re: Complement Arithmetic, -0 as a tag Message-ID: <1645@rlgvax.UUCP> Date: Wed, 1-Feb-84 18:33:56 EST Article-I.D.: rlgvax.1645 Posted: Wed Feb 1 18:33:56 1984 Date-Received: Tue, 7-Feb-84 13:02:01 EST References: <5260@uiucdcs.UUCP> <262@pyuxss.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 26 If -(2^(word size - 1)) were treated as an "unitialized variable" tag on a twos-complement machine, that would mean that you would need signed and unsigned add/subtract instructions; the bit pattern (1 shifted_left word_size-1) is a valid unsigned number in the middle of the valid range of unsigned numbers, so it shouldn't cause a trap. In fact, it could even be nasty on a ones-complement machine, because (1 shifted_left word_size-1) is a valid bit pattern even if you want to declare it an invalid number. This is OK with floating point because one very rarely treats a bit pattern labelled as a floating point number as other than a floating point number; however, most machines manipulate short bit strings and numbers with the same instructions. On a register machine, for instance, you'd need a "load signed number" instruction and a "load unsigned number/bit string/pointer/..." instruction. There ain't no such thing as a free lunch. To have special "invalid values" for a data type (henceforth referred to as NaN's, for "Not a Number", from the IEEE floating point standard), you need to declare some subset of the set of all 2^word_size values not to be usable. Since a bit string can, by definition, contain all members of this set, you can't catch an unitialized bit string. The same applies for any other type where there are not "obvious" candidate bit patterns for exclusion. The only solution to this is to enlarge the set of valid bit patterns and exclude some of the new patterns; the way the set is usually enlarged is by the addition of a tag bit or bits... Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy