Re: Negative Numbers in "Identity" or" Autonumber" fields

From: David Cressey <cressey73_at_verizon.net>
Date: Tue, 20 Mar 2007 13:05:34 GMT
Message-ID: <y_QLh.8001$FS5.1983_at_trndny09>


"paul c" <toledobythesea_at_oohay.ac> wrote in message news:1vELh.38348$DN.2312_at_pd7urf2no...
> Bob Badour wrote:
> ...
> > As a matter of fact, I recently suggested using the negative range for
> > extending a system. The positive range of one key was exposed to the
> > users who naturally started using it frequently in their communications.
> > ...
>
> That could be smart. I remember a group of smart people trying to
> figure out how to retrofit limitless tail recursion to a compiler and
> interpreter and after a period of months, they proposed a great number
> of changes. Whereas the language forbade certain characters, like "#"
> ala SQL, if I recall, which the interpreter could have recognized
> without the compiler ever knowing about. I estimated the change cost at
> about a half day, guaranteed! Of course, it would have been
> embarrassing to go that route after all that study time.
>
> p

There is another way of extending a set of values, and it is widely used, even if it's not quite legitimate. Instead of using negative numbers, what's used is "10s complement numbers". This, in 9 digit numbers, the 10s complement of "000,000,001" is "999,999,999". The 10s complement of "000,000,002" is "999,999,998".

The 10s complement system works like the 2s complement system, except the radix is 10 rather than 2.

If you "know" that the valid instances of the item in question are clustered around the range "000,000,001" to "499,999,999", then you can use 10s complement without fear of creating homonyms. Of course, you have to remember the fact that "500,000,000" and up are reserved for a special meaning, or else you'll eventually be faced with a problem like the Y2K problem.

This has the advantage that you don't have to alter the existing software. It has the disadvantage that you have to manage some data manually, with the cost and errors that this incurs.

I chose 9 digit numbers advisedly. Some systems store "fake social security numbers" in exactly this way. Received on Tue Mar 20 2007 - 14:05:34 CET

Original text of this message