1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/freebl/mpi/stats Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,39 @@ 1.4 +#!/usr/bin/perl 1.5 + 1.6 +# 1.7 +# Treat each line as a sequence of comma and/or space delimited 1.8 +# floating point numbers, and compute basic statistics on them. 1.9 +# These are written to standard output 1.10 + 1.11 +# This Source Code Form is subject to the terms of the Mozilla Public 1.12 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.13 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.14 + 1.15 +$min = 1.7976931348623157E+308; 1.16 +$max = 2.2250738585072014E-308; 1.17 +$sum = $num = 0; 1.18 + 1.19 +while(<>) { 1.20 + chomp; 1.21 + 1.22 + @nums = split(/[\s,]+/, $_); 1.23 + next if($#nums < 0); 1.24 + 1.25 + $num += scalar @nums; 1.26 + foreach (@nums) { 1.27 + $min = $_ if($_ < $min); 1.28 + $max = $_ if($_ > $max); 1.29 + $sum += $_; 1.30 + } 1.31 +} 1.32 + 1.33 +if($num) { 1.34 + $avg = $sum / $num; 1.35 +} else { 1.36 + $min = $max = 0; 1.37 +} 1.38 + 1.39 +printf "%d\tmin=%.2f, avg=%.2f, max=%.2f, sum=%.2f\n", 1.40 + $num, $min, $avg, $max, $sum; 1.41 + 1.42 +# end