security/nss/lib/freebl/mpi/stats

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 #!/usr/bin/perl
     3 #
     4 # Treat each line as a sequence of comma and/or space delimited
     5 # floating point numbers, and compute basic statistics on them.
     6 # These are written to standard output
     8 # This Source Code Form is subject to the terms of the Mozilla Public
     9 # License, v. 2.0. If a copy of the MPL was not distributed with this
    10 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
    12 $min = 1.7976931348623157E+308;
    13 $max = 2.2250738585072014E-308;
    14 $sum = $num = 0;
    16 while(<>) {
    17     chomp;
    19     @nums = split(/[\s,]+/, $_);
    20     next if($#nums < 0);
    22     $num += scalar @nums;
    23     foreach (@nums) {
    24 	$min = $_ if($_ < $min);
    25 	$max = $_ if($_ > $max);
    26 	$sum += $_;
    27     }
    28 }
    30 if($num) {
    31     $avg = $sum / $num;
    32 } else {
    33     $min = $max = 0;
    34 }
    36 printf "%d\tmin=%.2f, avg=%.2f, max=%.2f, sum=%.2f\n",
    37     $num, $min, $avg, $max, $sum;
    39 # end

mercurial