Re: autoconf macros, portable arithmetic

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

 



Hi,

On Fri, Feb 25, 2005 at 08:14:34AM +0100, Harald Dunkel wrote:
> If you put some other values here, then you get
> 
> 0.007 > 0.42

yes, you are right.  But it's easy to fix paul code:

# Example inputs
a=0.011
b=0.10

newline='
'

both=`echo "$a$newline$b" | sed 's/\.0*/./g'`
sorted=`
  echo "$both" | {
    # Use POSIX sort first, falling back on traditional sort.
    sort -t. -k1,1n -k1,1 -k2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 2>/dev/null ||
    sort -t. +0n -1 +0 -1 +1n -2 +1 -2 +2n -3 +2 -3 +3n -4 +3 -4
  }
`
echo $sorted
if test "x$both" = "x$sorted"; then
  echo "$a <= $b"
else
  echo "$a > $b"
fi

But to be true, I see no reson to delete the zeros, so I think the following
would be enough:

both=$a$newline$b

Have a nice day,
	Stepan


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux