#!/usr/bin/perl

$minratio = 0 ;
$maxratio = 2.0 ;
$binsize = 0.01 ;

$numbins = ($maxratio - $minratio)/$binsize ;

$prev = -1 ;
$count = 0 ;
@cdf = () ; 

while (<>) {
  $val = $_ ;
  if ($prev < 0) {
    $prev = $val ; 
  }
  else {
    if ($prev < 0.1) {
      $prev = 0.1 ;
    }
    if ($val > 0) {
      $tmp = $val/$prev ;
      for ($i = $numbins ; $i >= 0 ; $i --) {
        if ($tmp < $i*$binsize) {
          $cdf[$i] ++ ; 
        }
        else {
          last ; 
        }
      }
      $prev = $val ;
      $count ++ ;
    }
  }
}

printf "0 0\n";
for ($i = 1 ; $i < $numbins ; $i++) {
  printf "%.2f %.2f\n", $i*$binsize, $cdf[$i]/$count ; 
}

