Browse Source

Normalize inputs in combine.pl

pull/1/head
Pieter Wuille 13 years ago
parent
commit
044a8b6dbb
  1. 5
      combine.pl

5
combine.pl

@ -5,14 +5,19 @@ use strict;
sub loadFile { sub loadFile {
my ($file) = @_; my ($file) = @_;
my %ret; my %ret;
my $min = 100000000;
open FILE,$file; open FILE,$file;
while (<FILE>) { while (<FILE>) {
my ($addr,$p2h,$p8h,$p1d,$p1w,$p1m) = split(/\s+/,$_); my ($addr,$p2h,$p8h,$p1d,$p1w,$p1m) = split(/\s+/,$_);
if ($p1m =~ /\A([1-9.]+)%\Z/) { if ($p1m =~ /\A([1-9.]+)%\Z/) {
my $x = log($1*0.01)/log(0.5); my $x = log($1*0.01)/log(0.5);
$min=$x if ($x < $min);
$ret{$addr} = $x; $ret{$addr} = $x;
} }
} }
for my $k (keys %ret) {
$ret{$k} -= $min;
}
close FILE; close FILE;
return \%ret; return \%ret;
} }

Loading…
Cancel
Save