#!/usr/bin/perl

# Display Excess n tables
# Peter Walsh csci261 

sub displayExcessTable {
   $s = shift @_;
   $e = shift @_;
   $b = shift @_;

   print("Start $s End $e Bias $b \n");
   print("Number \t Excess \t Value \n");
   for ($i=$s; $i<=$e; $i++) {
      $excess=($i+$b) % (($e-$s)+1);
      $value=-($b-$i);
      print("$i  \t $excess \t \t $value \n");
   }
   print("\n");
}

#Excess 8
$start=0;
$end=15;
$bias=8;
displayExcessTable($start, $end, $bias);

#Excess 127
$start=1;
$end=254;
$bias=127;
displayExcessTable($start, $end, $bias);
