Byte order
Lawrence Crowl
crowl at rochester.ARPA
Sat Apr 26 06:21:47 AEST 1986
In article <1298 at mmintl.UUCP> franka at mmintl.UUCP (Frank Adams) writes:
]In article <17312 at rochester.ARPA> crowl at rochester.UUCP (Lawrence Crowl) writes:
]]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
]]require strings to be padded with nulls, or numbers to be padded with zeros.
]
]Basically, you use a unary notation (pure or modified) to indicate how long
]the number is, and the number follows. Using the scheme above, 257 would
]be ZZZ257. One and a half would be Z15. This is essentially floating point
]notation. ... This has to be modified a bit to deal with negative numbers. ...
]Also, for negative numbers, the digits should be in (9's) complement form. ...
]This can of course be done somewhat better. A higher radix can be used, and
]the exponent encoding can be further optimized. But the point is to describe
]the approach, not to work out all the details.
This seems good to me. If there are no radical alternatives, lets close the
issue.
--
Lawrence Crowl 716-275-5766 University of Rochester
Computer Science Department
...!{allegra,decvax,seismo}!rochester!crowl Rochester, New York, 14627
More information about the Comp.lang.c
mailing list