8 open (EXPECTED, '<', $ARGV[0]) or die "$ARGV[0]: open: $!\n";
9 open (ACTUAL, '<', $ARGV[1]) or die "$ARGV[1]: open: $!\n";
16 last if !defined $a && !defined $b;
17 die "$ARGV[0]:$.: unexpected end of file\n" if !defined $a;
18 die "$ARGV[1]:$.: unexpected end of file\n" if !defined $b;
20 my (@a) = split (' ', $a);
21 my (@b) = split (' ', $b);
22 die "$ARGV[1]:$.: contains ". scalar (@b) . " fields but should "
23 . "contain " . scalar (@a) . "\n"
25 foreach my $i (0...$#a) {
26 die "$ARGV[1]:$.: unexpected number of decimals\n"
27 if count_decimals ($a[$i]) != count_decimals ($b[$i]);
29 my ($an) = to_int ($a[$i]);
30 my ($bn) = to_int ($b[$i]);
31 if ($an ne $bn && ($bn < $an - $epsilon || $bn > $an + $epsilon)) {
34 print "$ARGV[1]: Additional differences suppressed.\n";
37 print "$ARGV[1]:$.: Values differ from $ARGV[0]:$.\n";
38 print "Expected:\n", $a;
39 print "Calculated:\n", $b;
47 return length (substr ($s, index ($s, '.')));