bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Human readable sort


From: Giuseppe Scrivano
Subject: Re: Human readable sort
Date: Thu, 21 May 2009 23:07:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.93 (gnu/linux)

Pádraig Brady <address@hidden> writes:

> +   Assume that numbers are properly abbreviated.
> +   i.e. input will never have both 5000K and 6M.  */

I think this is a too strong assumption.  I wouldn't be surprised to
find, for example, both 1M and 1500K in a data set.

Are there problems to normalize values using this pseudo-code?

while (abs (a) > 1000) //or 1024
  {
    order_a += signum (a);
    a /= 1000; //or 1024
  }

do the same with b and only after compare them.

Regards,
Giuseppe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]