On Mon, Apr 19, 2010 at 7:51 AM, David Golden <xda...@gmail.com> wrote:

> Dotted-decimals have a "round-trip" problem when being compared to
> decimals.  Depending on the order that things are converted, you can
> get different answers.
>
> Consider "v1.2.1000.3".  How should that be converted to a decimal
> version?

At the cost of both readability and backwards-compatibility,
prefixing each part with a length digit 0-9 where 0 means 1 and 9
means ten would give a round-trip capability for parts up to ten
digits long while preserving the ability to sort numerically after
converting to floating point. Add a final 5 always to prevent trailing
zeroes getting lost and annoy rounding algorithms.

v1.2.1000.3 would become 1.0231000035
v1.2.999.3   would become 1.022999035


-- 
I like to think that when I ramble on, I'm speaking for others who
share my opinions or point of view but who aren't as expressive.

Reply via email to