Michael Ludwig schrieb:
I assume what you mean is formatting the number so that the
lexicographical order of any possible sequence of acceptable numbers
is the same as its numerical order.

You must find a canonical representation like the scientific notation
and then tweak it as follows:

* "N" for negative and "P" for positive numbers ("N" sorts before "P")
* fixed-width zero-padded exponent first, like "E0000000003", base 10
* one digit with marker, like "N2"
* fixed-width zero-padded decimals with marker, like "D008000000000"

This is 2008, "PE0000000003N2D008000000000". YMMV, of course.

This notation falls short of achieving the goal to make lexicographical
order coincide with numerical order. First, negative numbers won't sort
in ascending order; -1 will come before -2. Second, negative exponents
aren't accounted for at all. Third, there are probably other problems.

Take a look at Steven Rowe's post in this thread for better
thought through ideas.

Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to