lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <...@as-guides.com>
Subject Re: BigDecimal values
Date Fri, 21 Nov 2008 10:20:58 GMT
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: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message