Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!rochester!crowl From: crowl@rochester.ARPA (Lawrence Crowl) Newsgroups: net.lang.c Subject: Re: Byte order (or you are both wrong) Message-ID: <17162@rochester.ARPA> Date: Sat, 12-Apr-86 16:06:42 EST Article-I.D.: rocheste.17162 Posted: Sat Apr 12 16:06:42 1986 Date-Received: Wed, 16-Apr-86 03:31:39 EST References: <7046@cca.UUCP> <6578@utzoo.UUCP> Reply-To: crowl@rochester.UUCP (Lawrence Crowl) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 29 Neither big-endian nor little-endian numbers can be sorted lexicographically. Since the only reason for for attempting to mix character string and number data is to save time, we must assume that we will have an arbitrary mix if characters and numbers, including different size numbers. When sorted lexicographically, the numbers in little-endian format are sorted based on the low order digit. For example 32 > 41. CLEARLY WRONG. When sorted lexicographically, the numbers in big-endian format are sorted based on the first high order digit of each number. This presents a problem when numbers are of different sizes. For example, 32 > 126. CLEARLY WRONG. In both cases, using two's complement sign representation causes problems. For example, both have -41 > 41. CLEARLY WRONG. The basic problem is that our definition of lexicographic sorting is incompatible with our (natural) definition of numeric sorting. CHALLENGE: Come up with a scheme for representing numbers, and a sorting scheme in which numbers sort naturally. Your scheme must deal with variable length character strings and variable size numbers. That is, you cannot requires strings to be padded with nulls, or numbers to be padded with zeros. Note that many part numbering schemes have intermixed letters and digits. -- Lawrence Crowl 716-275-5766 University of Rochester Computer Science Department ...!{allegra,decvax,seismo}!rochester!crowl Rochester, New York, 14627