num-utils (0.5-11) direct (non packaging) changes

Summary

 GOALS      |   40 ++++++++++++++++++++--------------------
 Makefile   |   36 ++++++++++++++++++------------------
 README     |   14 +++++++-------
 average    |   40 ++++++++++++++++++++++++----------------
 bound      |   28 ++++++++++++++--------------
 interval   |   20 ++++++++++----------
 normalize  |   26 +++++++++++++-------------
 numgrep    |    4 ++--
 numprocess |    4 ++--
 numsum     |   29 +++++++++++++++++++++--------
 random     |   40 ++++++++++++++++++++--------------------
 range      |   42 ++++++++++++++++++++----------------------
 round      |   32 ++++++++++++++++----------------
 template   |    4 ++--
 14 files changed, 189 insertions(+), 170 deletions(-)

    
download this patch

Patch contents

--- num-utils-0.5.orig/Makefile
+++ num-utils-0.5/Makefile
@@ -22,15 +22,15 @@
 PROJECT	= num-utils
 DIST	= $(PROJECT)-$(VERSION)
 FILES	= $(shell cat MANIFEST)
-UTILS	= average bound interval normalize numgrep numprocess numsum random range round
+UTILS	= numaverage numbound numinterval numnormalize numgrep numprocess numsum numrandom numrange numround
 DOCS	= CHANGELOG COPYING LICENSE MANIFEST template README GOALS WARNING
 TESTS	= file fractionalnums numbers numbers2 README zeros
 # rpm --showrc is gettin to be hard to parse anymore.
 #RPMDIR	= /usr/src/redhat  
-RPMDIR	= $(shell rpm --showrc | grep " _topdir" | \
-	perl -n -e \
-	'/_topdir(?:\s+|\s+:\s+)(\/.*|%{_usrsrc}.*$$)/; \
-	$$dir = $$1; $$dir =~ s|%{_usrsrc}|/usr/src|; print "$$1\n";')
+#RPMDIR	= $(shell rpm --showrc | grep " _topdir" | \
+#	perl -n -e \
+#	'/_topdir(?:\s+|\s+:\s+)(\/.*|%{_usrsrc}.*$$)/; \
+#	$$dir = $$1; $$dir =~ s|%{_usrsrc}|/usr/src|; print "$$1\n";')
 
 # Modify these as nessecary
 PERL	= /usr/bin/perl
@@ -52,35 +52,35 @@
 		mv $$file.out $$file ; chmod a+x $$file ; done
 
 install:
-	install -m 0755 -o 0 -g 0 -d		$(BINDIR)
+	install -m 0755 -o 0 -g 0 -d		$(DESTDIR)/$(BINDIR)
 	for util in $(UTILS) ; do \
-	    install -m 0755 -o 0 -g 0 $$util	$(BINDIR) ; done
+	    install -m 0755 -o 0 -g 0 $$util	$(DESTDIR)/$(BINDIR) ; done
 
-	install -m 0755 -o 0 -g 0 -d		$(DOCDIR)
+	install -m 0755 -o 0 -g 0 -d		$(DESTDIR)/$(DOCDIR)
 	for doc in $(DOCS) ; do \
-	    install -m 0644 -o 0 -g 0 $$doc	$(DOCDIR) ; done
+	    install -m 0644 -o 0 -g 0 $$doc	$(DESTDIR)/$(DOCDIR) ; done
 
-	install -m 0755 -o 0 -g 0 -d		$(MANDIR)
+	install -m 0755 -o 0 -g 0 -d		$(DESTDIR)/$(MANDIR)
 	for man in $(UTILS) ; do \
-		install -m 0644 -o 0 -g 0 $$man.1.gz $(MANDIR) ; done
+		install -m 0644 -o 0 -g 0 $$man.1.gz $(DESTDIR)/$(MANDIR) ; done
 
 uninstall:
 	for util in $(UTILS) ; do \
-		rm -f $(BINDIR)/$$util ; done
-	rmdir $(BINDIR)
+		rm -f $(DESTDIR)/$(BINDIR)/$$util ; done
+	rmdir $(DESTDIR)/$(BINDIR)
 
 	for doc in $(DOCS) ; do \
-		rm -f $(DOCDIR)/$$doc ; done
-	rmdir $(DOCDIR)
+		rm -f $(DESTDIR)/$(DOCDIR)/$$doc ; done
+	rmdir $(DESTDIR)/$(DOCDIR)
 
 	for man in $(UTILS) ; do \
-		rm -f $(MANDIR)/$$man.1.gz ; done
-	rmdir $(MANDIR)
+		rm -f $(DESTDIR)/$(MANDIR)/$$man.1.gz ; done
+	rmdir $(DESTDIR)/$(MANDIR)
 
 manpages:
 	for doc in $(UTILS) ; do \
 		pod2man $$doc > $$doc.1 ; \
-		gzip $$doc.1 ; chmod 644 $$doc.1.gz \
+		gzip -9 $$doc.1 ; chmod 644 $$doc.1.gz \
 		; done
 
 rpminstall:
--- num-utils-0.5.orig/template
+++ num-utils-0.5/template
@@ -124,7 +124,7 @@
 
 =head1 DESCRIPTION
 
-B<template> is a program that is part of the numeric utilities package.  B<template>
+B<template>
 will .......
 
 =head1 OPTIONS
@@ -136,7 +136,7 @@
 
 =head1 SEE ALSO
 
-average(1), bound(1), interval(1), normalize(1), numgrep(1), numprocess(1), numsum(1), random(1), range(1), round(1)
+numaverage(1), numbound(1), numinterval(1), numnormalize(1), numgrep(1), numprocess(1), numsum(1), numrandom(1), numrange(1), numround(1)
 
 =head1 COPYRIGHT
 
--- num-utils-0.5.orig/interval
+++ num-utils-0.5/interval
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# interval: This program calculates and displays the intervals between the
+# numinterval: This program calculates and displays the intervals between the
 # first line and the second, between the second line and the third on
 # through the end of the file.
 #   
@@ -73,7 +73,7 @@
 
 my $lastnumber;
 foreach $number (@number_array) {
-    if ($lastnumber) {
+    if (defined($lastnumber)) {
         $interval = $number - $lastnumber;
         print "$interval\n"; 
     }        
@@ -89,7 +89,7 @@
 sub help {
 	print <<"EOF";
 -----------------------------------------------------------------------
-interval : Calculate the numeric intervals between lines in input.
+numinterval : Calculate the numeric intervals between lines in input.
 -----------------------------------------------------------------------
 Usage:
 
@@ -124,19 +124,19 @@
 
 =head1 NAME
 
-interval - Show the numeric intervals between each line in a file.
+numinterval - Show the numeric intervals between each line in a file.
 
 =head1 SYNOPSIS
 
-B<interval> [-dhV] <FILE>
+B<numinterval> [-dhV] <FILE>
 
-| B<interval> [-dhV]    (Input on STDIN from pipeline.)
+| B<numinterval> [-dhV]    (Input on STDIN from pipeline.)
 
-B<interval> [-dhV]      (Input on STDIN.  Use Ctrl-D to stop.)
+B<numinterval> [-dhV]      (Input on STDIN.  Use Ctrl-D to stop.)
 
 =head1 DESCRIPTION
 
-B<inter> is a program that is part of the numeric utilities package.  B<interval>
+B<numinterval>
 will calculate and display the numeric interval between one number and the
 next on an input stream.
 
@@ -155,11 +155,11 @@
 
 =head1 SEE ALSO
 
-average(1), bound(1), normalize(1), numgrep(1), numprocess(1), numsum(1), random(1), range(1), round(1)
+numaverage(1), numbound(1), numnormalize(1), numgrep(1), numprocess(1), numsum(1), numrandom(1), numrange(1), numround(1)
 
 =head1 COPYRIGHT
 
-interval is part of the num-utils package, which is copyrighted by
+numinterval is part of the num-utils package, which is copyrighted by
 Suso Banderas and released under the GPL license.  Please read
 the COPYING and LICENSE files that came with the num-utils package
 
--- num-utils-0.5.orig/random
+++ num-utils-0.5/random
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# random: Print out a random number.
+# numrandom: Print out a random number.
 #   
 # Copyright (C) 2002-2004 Suso Banderas
 
@@ -60,7 +60,7 @@
 # MAIN PROGRAM #
 ################
 
-# This part is almost exactly the same as the range program, except
+# This part is almost exactly the same as the numrange program, except
 # for the last part of course.
 
 my $number_exp = "-?[0-9]*\\.?[0-9]+";
@@ -120,11 +120,11 @@
 sub help {
 	print <<"EOF";
 -------------------------------------
-random : Print out a random number.
+numrandom : Print out a random number.
 -------------------------------------
 Usage:
 
-    random [options] /[expression]/
+    numrandom [options] /[expression]/
 
 Options:
         -d      Debug. For developers only.
@@ -162,19 +162,19 @@
 
 =head1 NAME
 
-random - Print out a random number.
+numrandom - Print out a random number.
 
 =head1 SYNOPSIS
 
-B<random> [-dhV] /[expression]/
+B<numrandom> [-dhV] /[expression]/
 
 =head1 DESCRIPTION
 
-B<random> is a program that is part of the numeric utilities package.  B<random>
+B<numrandom>
 will print out a random number determined by the expression that you give.  The
-syntax and program is nearly identical to the B<range> program, except that B<random>
+syntax and program is nearly identical to the B<numrange> program, except that B<numrandom>
 picks a number at random from the range expression.  If no expression is specified,
-B<random> will print out a random integer between 1 and 100.
+B<numrandom> will print out a random integer between 1 and 100.
 
 =head1 OPTIONS
 
@@ -185,47 +185,47 @@
 =head1 EXAMPLES
 
    Random number from 1 to 10.
-    $ random /1..10/
+    $ numrandom /1..10/
     7
 
    From 1 to 10 or from 15 to 20.
-    $ random /1..10,15..20/
+    $ numrandom /1..10,15..20/
     16
 
    An even number from 0 to 10
-    $ random /0..10i2/
+    $ numrandom /0..10i2/
     4
 
    An odd number. Notice the starting number in the range.
-    $ random /1..10i2/
+    $ numrandom /1..10i2/
     9
 
    A factor of 3 between 99 and 120.
-    $ random /99..120i3/
+    $ numrandom /99..120i3/
     111
 
    A decimal number.
-    $ random /1.1..2.5i0.1/
+    $ numrandom /1.1..2.5i0.1/
     1.8
 
    A negative random number.
-    $ random /0.0..-2.0i0.3/
+    $ numrandom /0.0..-2.0i0.3/
     -0.8
 
 =head1 BUGS
 
-B<random> is slow when dealing with large ranges to randomly
+B<numrandom> is slow when dealing with large ranges to randomly
 find a number from.  This is because it creates a list of all
 potential numbers before picking one.  So it can be memory intensive
 for large ranges.
 
 =head1 SEE ALSO
 
-average(1), bound(1), interval(1), normalize(1), numgrep(1), numprocess(1), numsum(1), range(1), round(1)
+numaverage(1), numbound(1), numinterval(1), numnormalize(1), numgrep(1), numprocess(1), numsum(1), numrange(1), numround(1)
 
 =head1 COPYRIGHT
 
-random is part of the num-utils package, which is copyrighted by
+numrandom is part of the num-utils package, which is copyrighted by
 Suso Banderas and released under the GPL license.  Please read
 the COPYING and LICENSE files that came with the num-utils package
 
@@ -234,7 +234,7 @@
 
 =head1 MORE INFO
 
-More info on random can be found at:
+More info on numrandom can be found at:
 
 =over 1
 
--- num-utils-0.5.orig/numgrep
+++ num-utils-0.5/numgrep
@@ -332,7 +332,7 @@
     /f1024/  Match any integer that is a factor of 1024.
 
 
-    $ range -N /1..1000/ | numgrep /f1024/
+    $ numrange -N /1..1000/ | numgrep /f1024/
     1
     2
     4
@@ -359,7 +359,7 @@
 
 =head1 SEE ALSO
 
-average(1), bound(1), interval(1), normalize(1), numprocess(1), numsum(1), random(1), range(1), round(1)
+numaverage(1), numbound(1), numinterval(1), numnormalize(1), numprocess(1), numsum(1), numrandom(1), numrange(1), numround(1)
 
 =head1 COPYRIGHT
 
--- num-utils-0.5.orig/normalize
+++ num-utils-0.5/normalize
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# normalize:  Normalize a set of numbers. By default between 0 and 1.
+# numnormalize:  Normalize a set of numbers. By default between 0 and 1.
 #   
 # Copyright (C) 2002-2004 Suso Banderas
 
@@ -84,13 +84,13 @@
 sub help {
 	print <<"EOF";
 ----------------------------------------------
-normalize : Normalize a set of numbers.
+numnormalize : Normalize a set of numbers.
 ----------------------------------------------
 Usage:
 
-    normalize [options] <file>
-    | normalize [options]
-    normalize [options]
+    numnormalize [options] <file>
+    | numnormalize [options]
+    numnormalize [options]
 
 Options:
         -d      Debug. For developers only.
@@ -143,19 +143,19 @@
 
 =head1 NAME
 
-normalize - Normalize a set of numbers. By default between 0 and 1.
+numnormalize - Normalize a set of numbers. By default between 0 and 1.
 
 =head1 SYNOPSIS
 
-B<normalize> [-dhRV] <FILE>
+B<numnormalize> [-dhRV] <FILE>
 
-| B<normalize> [-dhRV]    (Input on STDIN from pipeline.)
+| B<numnormalize> [-dhRV]    (Input on STDIN from pipeline.)
 
-B<normalize> [-dhRV]      (Input on STDIN.  Use Ctrl-D to stop.)
+B<numnormalize> [-dhRV]      (Input on STDIN.  Use Ctrl-D to stop.)
 
 =head1 DESCRIPTION
 
-B<normalize> is a program that is part of the numeric utilities package.  B<normalize>
+B<numnormalize>
 will take a set of numbers on input and return that set as a normalized set of numbers
 between 0 and 1 by default.  Or you can use the -R option to specify a different normalized
 range.
@@ -172,11 +172,11 @@
 
 =head1 SEE ALSO
 
-average(1), bound(1), interval(1), numgrep(1), numprocess(1), numsum(1), random(1), range(1), round(1)
+numaverage(1), numbound(1), numinterval(1), numgrep(1), numprocess(1), numsum(1), numrandom(1), numrange(1), numround(1)
 
 =head1 COPYRIGHT
 
-normalize is part of the num-utils package, which is copyrighted by
+numnormalize is part of the num-utils package, which is copyrighted by
 Suso Banderas and released under the GPL license.  Please read
 the COPYING and LICENSE files that came with the num-utils package
 
@@ -185,7 +185,7 @@
 
 =head1 MORE INFO
 
-More info on normalize can be found at:
+More info on numnormalize can be found at:
 
 =over 1
 
--- num-utils-0.5.orig/numsum
+++ num-utils-0.5/numsum
@@ -124,7 +124,7 @@
             my @add_this_array = split(/ /, $number_array[$row_number-1]);
             my $row_sum = 0;
             foreach $row_value (@add_this_array) {
-                $row_sum += $row_value;
+                $row_sum = decimals_friendly_sum( $row_sum, $row_value );
             }
             print "$row_sum\n";
         }
@@ -133,8 +133,8 @@
             my @add_this_array = split(/ /, $number_array[$i]);
             my $row_sum = 0;
             foreach $row_value (@add_this_array) {
-                next if ($row_value !~ m/^[0-9]+$/);
-                $row_sum += $row_value;
+                next if ($row_value !~ m/^\-?[0-9]*\.?[0-9]+$/);
+                $row_sum = decimals_friendly_sum( $row_sum, $row_value );
             }
             print "$row_sum\n";
         }
@@ -193,6 +193,19 @@
 EOF
 }
 
+sub decimals_friendly_sum
+{
+        # try summing 1.99 and -1.90 to understand why
+        my $number_a = shift;
+        my $number_b = shift;
+        my $dec_a = ( $number_a =~ /\.([^\.]*)$/ ? length($1) : 0 );
+        my $dec_b = ( $number_b =~ /\.([^\.]*)$/ ? length($1) : 0 );
+        my $factor = 10 ** ( $dec_a > $dec_b ? $dec_a : $dec_b );
+        $number_a *= $factor;
+        $number_b *= $factor;
+        return ( $number_a + $number_b ) / $factor;
+}
+
 # This function is used so that we can genericize what filehandle
 # we are getting our information from.
 sub process_filehandle {
@@ -213,7 +226,7 @@
             #s!(\S+)!$1=~/\D/?0:$1!ge;
           
             # This one works best. 
-            $line =~ s!(\S+)!$1=~/\D/?0:$1!ge;
+            $line =~ s!(\S+)!$1=~/^(\-?[0-9]*\.?[0-9]+)$/?$1:0!ge;
 
             push(@$number_array_ref, $line);
 
@@ -236,7 +249,7 @@
 
     foreach $number (@$arrayref) {
         print STDERR "$number\n" if ($verbose >= 2);
-        $runningtotal += $number;
+        $runningtotal = decimals_friendly_sum( $runningtotal, $number );
     }
     return $runningtotal;
 }
@@ -251,7 +264,7 @@
     my $x;
     for ($x = 0; $x < $input_array_length; $x++) {
         if (${$sum_array_ref}[$x]) {
-            ${$sum_array_ref}[$x] += ${$input_array_ref}[$x];
+            ${$sum_array_ref}[$x] = decimals_friendly_sum( ${$sum_array_ref}[$x], ${$input_array_ref}[$x] );
         } else {
             ${$sum_array_ref}[$x] = ${$input_array_ref}[$x];
         }
@@ -277,7 +290,7 @@
 
 =head1 DESCRIPTION
 
-B<numsum> is a program that is part of the numeric utilities package.  B<numsum>
+B<numsum>
 will take all the numbers on stdin and return the sum of those numbers.  Currently
 it only processes the first number on each line.  Besides positive numbers, it also
 handles negative numbers and numbers with decimals.
@@ -359,7 +372,7 @@
 
 =head1 SEE ALSO
 
-average(1), bound(1), interval(1), normalize(1), numgrep(1), numprocess(1), random(1), range(1), round(1)
+numaverage(1), numbound(1), numinterval(1), numnormalize(1), numgrep(1), numprocess(1), numrandom(1), numrange(1), numround(1)
 
 =head1 COPYRIGHT
 
--- num-utils-0.5.orig/GOALS
+++ num-utils-0.5/GOALS
@@ -305,7 +305,7 @@
 
 
 
--- average --
+-- numaverage --
 
  This program finds the average of all numbers encountered.  By default it will
 find the mean average of all the numbers.  Meaning (;-) that it will add up all
@@ -321,7 +321,7 @@
     9
     20
     99 
-    $ average numbers
+    $ numaverage numbers
     28
     
   Usage options:
@@ -368,7 +368,7 @@
  Usage options  (in addition to the standard options)
 
 
--- normalize --
+-- numnormalize --
 
   This program will distribute a group of numbers between 0 and 1 by default according
   to their initial value.  You can change the range using the -R option.
@@ -379,7 +379,7 @@
 
 
 
--- round --
+-- numround --
 
    This utility will round each number encountered up or down depending on it's
   decimal value or it's relation to a number.  It will probably also deal with
@@ -398,7 +398,7 @@
 X   -f  -- Find the floor of each number.  Round down.
 
 
--- range --
+-- numrange --
 
   Print out a range of numbers for use in for loops and such.
 
@@ -431,21 +431,21 @@
          you want to do a complex range without including certain numbers.
          <set> is a list of numbers seperated by a ','.
 
--- random --
+-- numrandom --
 
   Print out a random number or numbers.  This program will take a range of
- numbers much like the range command does.  Except that instead of printing out
+ numbers much like the numrange command does.  Except that instead of printing out
  all the numbers in that range, it will print out a random number from that
  range.
 
    Ex:
-       $ random 1..100
+       $ numrandom 1..100
        37
-       $ random 1.0..100.0
+       $ numrandom 1.0..100.0
        56.9
-       $ random 1.000..100.000
+       $ numrandom 1.000..100.000
        42.397
-       $ random 2..100i2   [only pick among the even integers from 2 to 100]
+       $ numrandom 2..100i2   [only pick among the even integers from 2 to 100]
        68
 
  Usage options  (in addition to the standard options)
@@ -461,13 +461,13 @@
 probably, this is just an equal distribution. What would come in handy
 quite often is to have a way of producing pseudo-random numbers that
 realize a chosen distribution with a given set of parameters. But that
-should probably be a different program than random, e.g. distribution,
+should probably be a different program than numrandom, e.g. distribution,
 as the name is already taken. So, e.g., ``distribution --gaussian 3.0
 4.0 100'' should produce 100 numbers distributed according to a gauss
 distribution with mean 3 and variance 4.
 
 
--- bound --
+-- numbound --
 
   This program is for finding the maximum, minimum and surrounding numbers in a
  set.  You can use different options to specify how many numbers are returned as
@@ -478,33 +478,33 @@
      $ cat numbers
      1 10 8 100 15 1000
      2 9 5 15 27 12 136
-     $ bound -u numbers   (upper)
+     $ numbound -u numbers   (upper)
      1000
-     $ bound -l numbers   (lower)
+     $ numbound -l numbers   (lower)
      1
 
   Top 4 upper numbers sorted
-     $ bound -u -n 4 numbers
+     $ numbound -u -n 4 numbers
      1000
      136
      100
      27
 
   Bottom 4 lower numbers sorted)
-     $ bound -l -n 4 numbers
+     $ numbound -l -n 4 numbers
      1
      2
      5
      8
 
   Context around lowest number.  Show 2 numbers of context.
-     $ bound -l -c 2 numbers
+     $ numbound -l -c 2 numbers
      1 10 8
 
   Find the 5 closet numbers to the number 75.  They will print out
   in closeness order.
   
-     $ bound -f 75 -n 6
+     $ numbound -f 75 -n 6
      100
      27
      15
@@ -549,7 +549,7 @@
 
 
 
--- interval --
+-- numinterval --
 
   This program calculates and displays the interval between one number
   and the next.
--- num-utils-0.5.orig/bound
+++ num-utils-0.5/bound
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# bound: Find boundary numbers in files or STDIN.
+# numbound: Find boundary numbers in files or STDIN.
 #   
 # Copyright (C) 2002-2004 Suso Banderas
 
@@ -87,13 +87,13 @@
 sub help {
 	print <<"EOF";
 -------------------------------------------------------------------------------
-bound : Find boundary numbers in files or STDIN.  By default, find the maximum.
+numbound : Find boundary numbers in files or STDIN.  By default, find the maximum.
 -------------------------------------------------------------------------------
 Usage:
 
-    bound [options] <file>
-    | bound [options]
-    bound [options]
+    numbound [options] <file>
+    | numbound [options]
+    numbound [options]
 
 Options:
         -l  -- Return the lower bound number in the set  (the minimum number)
@@ -148,19 +148,19 @@
 
 =head1 NAME
 
-bound - Find boundary numbers in files or STDIN.
+numbound - Find boundary numbers in files or STDIN.
 
 =head1 SYNOPSIS
 
-B<bound> [-dhlV] <FILE>
+B<numbound> [-dhlV] <FILE>
 
-| B<bound> [-dhlV]     (Input on STDIN from pipeline.)
+| B<numbound> [-dhlV]     (Input on STDIN from pipeline.)
 
-B<bound> [-dhlV]       (Input on STDIN.  Use Ctrl-D to stop.)
+B<numbound> [-dhlV]       (Input on STDIN.  Use Ctrl-D to stop.)
 
 =head1 DESCRIPTION
 
-B<bound> is a program that is part of the numeric utilities package.  B<bound>
+B<numbound>
 will find boundary numbers (minimum and maximum) in files or STDIN.  By default
 it will find the upper bound in the set of numbers (the maximum number) in the
 files or on STDIN.  You can use the -l option for finding the lower bound (minumum
@@ -176,16 +176,16 @@
 
 =head1 BUGS
 
-B<bound> currently will only gather the first number on each line instead of
+B<numbound> currently will only gather the first number on each line instead of
 all the numbers on the lines.
 
 =head1 SEE ALSO
 
-average(1), interval(1), normalize(1), numgrep(1), numprocess(1), numsum(1), random(1), range(1), round(1)
+numaverage(1), numinterval(1), numnormalize(1), numgrep(1), numprocess(1), numsum(1), numrandom(1), numrange(1), numround(1)
 
 =head1 COPYRIGHT
 
-bound is part of the num-utils package, which is copyrighted by
+numbound is part of the num-utils package, which is copyrighted by
 Suso Banderas and released under the GPL license.  Please read
 the COPYING and LICENSE files that came with the num-utils package
 
@@ -194,7 +194,7 @@
 
 =head1 MORE INFO
 
-More info on bound can be found at:
+More info on numbound can be found at:
 
 =over 1
 
--- num-utils-0.5.orig/numprocess
+++ num-utils-0.5/numprocess
@@ -182,7 +182,7 @@
 
 =head1 DESCRIPTION
 
-B<numprocess> is a program that is part of the numeric utilities package.  B<numprocess>
+B<numprocess>
 will take as one argument, a list of operations to be performed on numbers that it
 encounters.  It will perform those operations on each number and return the result in place
 of the original number.
@@ -237,7 +237,7 @@
 
 =head1 SEE ALSO
 
-average(1), bound(1), interval(1), normalize(1), numgrep(1), numsum(1), random(1), range(1), round(1)
+numaverage(1), numbound(1), numinterval(1), numnormalize(1), numgrep(1), numsum(1), numrandom(1), numrange(1), numround(1)
 
 =head1 BUGS
 
--- num-utils-0.5.orig/round
+++ num-utils-0.5/round
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# round: A program that rounds off numbers it encounters.
+# numround: A program that rounds off numbers it encounters.
 #   
 # Copyright (C) 2002-2004 Suso Banderas
 
@@ -84,13 +84,13 @@
 sub help {
 	print <<"EOF";
 ---------------------------------------------------------
-round : A program that rounds off numbers it encounters.
+numround : A program that rounds off numbers it encounters.
 ---------------------------------------------------------
 Usage:
 
-    round [options] <file>
-    | round [options]
-    round [options]
+    numround [options] <file>
+    | numround [options]
+    numround [options]
 
 Options:
         -c      Force the number to be rounded up. Ceiling.
@@ -162,19 +162,19 @@
 
 =head1 NAME
 
-round - A program that rounds off numbers it encounters.
+numround - A program that rounds off numbers it encounters.
 
 =head1 SYNOPSIS
 
-B<round> [-cdfhV] <FILE>
+B<numround> [-cdfhV] <FILE>
 
-| B<round> [-cdfhV]   (Input on STDIN from pipeline.)
+| B<numround> [-cdfhV]   (Input on STDIN from pipeline.)
 
-B<round> [-cdfhV]     (Input on STDIN.  Use Ctrl-D to stop.)
+B<numround> [-cdfhV]     (Input on STDIN.  Use Ctrl-D to stop.)
 
 =head1 DESCRIPTION
 
-B<round> is a program that is part of the numeric utilities package.  B<round>
+B<numround>
 will simply round decimal numbers to the nearest integer or to a factor of any
 number using the -n option.  You can also force it to round up (ceiling) or
 round down(floor) using the -c and -f options.
@@ -185,26 +185,26 @@
     -f      Force the number to be rounded down. Floor.
     -n <n>  Round numbers to the nearest factor of <n>.
 
-    -h      Print out some helpful information about round.
+    -h      Print out some helpful information about numround.
     -V      Increase verbosity.  This will print out numbers as it finds them.
     -d      Debug mode.  For developers only.
 
 
 =head1 BUGS
 
-B<round> currently only rounds the first number on each line.  Eventually this
+B<numround> currently only rounds the first number on each line.  Eventually this
 will be changed as all the numeric utilities are developed.
 
-B<round> will drop off the decimal places in decimal numbers.  This may cause
+B<numround> will drop off the decimal places in decimal numbers.  This may cause
 some calculations to be in error, depending on how you are using the data.
 
 =head1 SEE ALSO
 
-average(1), bound(1), interval(1), normalize(1), numgrep(1), numprocess(1), numsum(1), random(1), range(1)
+numaverage(1), numbound(1), numinterval(1), numnormalize(1), numgrep(1), numprocess(1), numsum(1), numrandom(1), numrange(1)
 
 =head1 COPYRIGHT
 
-round is part of the num-utils package, which is copyrighted by
+numround is part of the num-utils package, which is copyrighted by
 Suso Banderas and released under the GPL license.  Please read
 the COPYING and LICENSE files that came with the num-utils package
 
@@ -213,7 +213,7 @@
 
 =head1 MORE INFO
 
-More info on round can be found at:
+More info on numround can be found at:
 
 =over 1
 
--- num-utils-0.5.orig/range
+++ num-utils-0.5/range
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# range: Print out a range of numbers for use in for loops and such.
+# numrange: Print out a range of numbers for use in for loops and such.
 #   
 # Copyright (C) 2002-2004 Suso Banderas
 
@@ -55,11 +55,9 @@
 my $range_expression = shift || die "You must specify a range expression\n";
 
 # A shortcut for specifying a prefix and suffix.
-$range_expression =~ m/^([^\/]+)\//;
-$prefix = $1;
+$prefix = $1 if( $range_expression =~ m/^([^\/]+)\// );
 $range_expression =~ s/^[^\/]+\//\//;
-$range_expression =~ m/\/([^\/]+)$/;
-$suffix = $1;
+$suffix = $1 if( $range_expression =~ m/\/([^\/]+)$/ );
 $range_expression =~ s/\/[^\/]+$/\//;
 
 $range_expression =~ s/^\///;
@@ -155,11 +153,11 @@
 sub help {
 	print <<"EOF";
 --------------------------------------------------------------------
-range : Print out a range of numbers for use in for loops and such.
+numrange : Print out a range of numbers for use in for loops and such.
 --------------------------------------------------------------------
 Usage:
 
-    range [options] /<expression>/
+    numrange [options] /<expression>/
 
 Options:
         -e <set> Exclude the <set> of numbers from the range output.  <set>
@@ -194,15 +192,15 @@
 
 =head1 NAME
 
-range - Print out a range of numbers for use in for loops and such.
+numrange - Print out a range of numbers for use in for loops and such.
 
 =head1 SYNOPSIS
 
-B<range> [-dhV] /<expression>/
+B<numrange> [-dhV] /<expression>/
 
 =head1 DESCRIPTION
 
-B<range> is a program that is part of the numeric utilities package.  B<range>
+B<numrange>
 will print out a list of numbers based on an expression that you specify.  This
 is useful for making a list of numbers for use in for loops and so on.  Ranges of
 numbers are specified using the .. operator, like this /20..50/, which means all
@@ -225,41 +223,41 @@
 =head1 EXAMPLES
 
    All numbers from 1 to 10.
-    $ range /1..10/
+    $ numrange /1..10/
     1 2 3 4 5 6 7 8 9 10
 
    From 10 to 1. Counting down.
-    $ range /10..1/
+    $ numrange /10..1/
     10 9 8 7 6 5 4 3 2 1
 
    From 1 to 10 and from 15 to 20.
-    $ range /1..10,15..20/
+    $ numrange /1..10,15..20/
     1 2 3 4 5 6 7 8 9 10 15 16 17 18 19 20
 
    Even numbers from 0 to 10
-    $ range /0..10i2/
+    $ numrange /0..10i2/
     0 2 4 6 8 10
 
    Odd numbers.  Notice the starting number in the range expression.
-    $ range /1..10i2/
+    $ numrange /1..10i2/
     1 3 5 7 9
 
    Factors of 3 between 99 and 120.
-    $ range /99..120i3/
+    $ numrange /99..120i3/
     99 102 105 108 111 114 117 120
 
    Decimal numbers
-    $ range /1.1..2.5i0.1/
+    $ numrange /1.1..2.5i0.1/
     1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2 2.3 2.4 2.5
 
    And negative numbers too.
-    $ range /1.0..-2.0i0.3/
+    $ numrange /1.0..-2.0i0.3/
     1 0.7 0.4 0.1 -0.2 -0.5 -0.8 -1.1 -1.4 -1.7 -2
 
    You can also pad numbers when you are counting up.  This is
    a trick of how the Perl programming language deals with ranges:
    
-    $ range /01..15/
+    $ numrange /01..15/
     01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
 
 =head1 BUGS
@@ -270,11 +268,11 @@
 
 =head1 SEE ALSO
 
-seq(1), average(1), bound(1), interval(1), normalize(1), numgrep(1), numprocess(1), numsum(1), random(1), round(1)
+seq(1), numaverage(1), numbound(1), numinterval(1), numnormalize(1), numgrep(1), numprocess(1), numsum(1), numrandom(1), numround(1)
 
 =head1 COPYRIGHT
 
-range is part of the num-utils package, which is copyrighted by
+numrange is part of the num-utils package, which is copyrighted by
 Suso Banderas and released under the GPL license.  Please read
 the COPYING and LICENSE files that came with the num-utils package
 
@@ -283,7 +281,7 @@
 
 =head1 MORE INFO
 
-More info on range can be found at:
+More info on numrange can be found at:
 
 =over 1
 
--- num-utils-0.5.orig/average
+++ num-utils-0.5/average
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# average:  Find the average of a set of numbers.
+# numaverage:  Find the average of a set of numbers.
 #
 # Copyright (C) 2002-2004 Suso Banderas
 
@@ -99,18 +99,19 @@
 sub help {
 	print <<"EOF";
 ---------------------------------------------------------
-average : A program for finding the average of numbers.
+numaverage : A program for finding the average of numbers.
 ---------------------------------------------------------
 Usage:
-    average [options] file
-    | average [options]
-    average [options]
+    numaverage [options] file
+    | numaverage [options]
+    numaverage [options]
 
 Options:
         -i      Only return the integer portion of the final sum.
         -I      Only return the decimal portion of the final sum
 
-        -m      Find the mode (most occuring) of the list of numbers.
+        -m      Find the mode (most occuring) of the list of numbers,
+                or when there's more than one mode, the first completed mode.
         -M      Find the median (middle number) of the list of numbers.
         -l      When finding the median and the count of numbers in the set is even,
                 use the lower middle number instead of the upper middle number.
@@ -144,6 +145,12 @@
         $runningtotal += $number;
         print STDERR "adding number: $number  (total: $runningtotal)\n" if ($verbose >= 3);
     }
+    if( $number_of_numbers <= 0 )
+    {
+    	print STDERR "Empty list of numbers\n";
+	&help();
+	exit(-1);
+    }
     $average = $runningtotal / $number_of_numbers;
     print STDERR "averaging numbers: $runningtotal total / $number_of_numbers numbers = $average\n" if ($verbose >= 2);
     return $average;
@@ -197,20 +204,20 @@
 
 =head1 NAME
 
-average - Find the average of a set of numbers.
+numaverage - Find the average of a set of numbers.
 
 =head1 SYNOPSIS
 
-B<average> [-dhiIlmMV] <FILE>
+B<numaverage> [-dhiIlmMV] <FILE>
 
-| B<average> [-dhiIlmMV]    (Input on STDIN from pipeline.)
+| B<numaverage> [-dhiIlmMV]    (Input on STDIN from pipeline.)
 
-B<average> [-dhiIlmMV]      (Input on STDIN.  Use Ctrl-D to stop.)
+B<numaverage> [-dhiIlmMV]      (Input on STDIN.  Use Ctrl-D to stop.)
 
 =head1 DESCRIPTION
 
-B<average> is a program that is part of the numeric utilities package.  By default
-B<average> will determine the average from all numbers on input.  Other
+By default 
+B<numaverage> will determine the average from all numbers on input.  Other
 options allow you to find the mode and median.
 
 =head1 OPTIONS
@@ -218,7 +225,8 @@
     -i  Only return the integer portion of the final sum.
     -I  Only return the decimal portion of the final sum
 
-    -m  Find the mode (most occuring) of the list of numbers.
+    -m  Find the mode (most occuring) of the list of numbers,
+        or when there's more than one mode, the first completed mode.
     -M  Find the median (middle number) of the list of numbers.
     -l  When finding the median and the count of numbers in the set is even,
         use the lower middle number instead of the upper middle number.
@@ -230,11 +238,11 @@
 
 =head1 SEE ALSO
 
-bound(1), interval(1), normalize(1), numgrep(1), numprocess(1), numsum(1), random(1), range(1), round(1)
+numbound(1), numinterval(1), numnormalize(1), numgrep(1), numprocess(1), numsum(1), numrandom(1), numrange(1), numround(1)
 
 =head1 COPYRIGHT
 
-average is part of the num-utils package, which is copyrighted by
+numaverage is part of the num-utils package, which is copyrighted by
 Suso Banderas and released under the GPL license.  Please read
 the COPYING and LICENSE files that came with the num-utils package
 
@@ -243,7 +251,7 @@
 
 =head1 MORE INFO
 
-More info on average can be found at:
+More info on numaverage can be found at:
 
 =over 1
 
--- num-utils-0.5.orig/README
+++ num-utils-0.5/README
@@ -58,21 +58,21 @@
         -1
         3
 
-   random - Generates random numbers based on range expressions.
+   numrandom - Generates random numbers based on range expressions.
 
-        $ randnum /0..100/
+        $ numrandom /0..100/
         47
         $
 
-   range -  This program will spit out a sequence of numbers for use in stuff
+   numrange -  This program will spit out a sequence of numbers for use in stuff
            like shell for loops.  The syntax for this program will most likely
            change in the next version.
 
-        $ range /5..10/
+        $ numrange /5..10/
         5 6 7 8 9 10
         $
         
-        $ for i in `range /1..5,10..15/` ; do mv track$i.mp3 song$i.mp3 ; done
+        $ for i in `numrange /1..5,10..15/` ; do mv track$i.mp3 song$i.mp3 ; done
         1
         2
         3
@@ -86,7 +86,7 @@
         15
         $
 
-   interval - This program will calculate and display the interval between
+   numinterval - This program will calculate and display the interval between
    every two seqeuntial numbers on the input stream:
 
        $ cat numbers
@@ -99,7 +99,7 @@
        35
        2
        1
-       $ cat numbers | interval
+       $ cat numbers | numinterval
        1
        1
        2