Help for this page

Select Code to Download


  1. or download this
    # step 1
    sub binary {
    ...
    #step 4
       return $E . $b;
       }
    
  2. or download this
    # step 1
    sub binary ($n) {
    ...
    #step 4
       return $E ~ $b;
       }
    
  3. or download this
    sub binary (0|1 $n) { $n }
    
    ...
       my $E = binary($k);
       return $E ~ $b;
       }
    
  4. or download this
    sub binary (Int where { $_ < 0 } $n)
    {
       my $E= binary(-$n);
       return "-" ~ $E;
    }
    
  5. or download this
    subset NegativeInt of Int where { $_ < 0 } # I decided to declare it a
    +fter all
    subset PositiveInt of Int where { $_ > 0 }
    ...
          return "-" ~ binary(-$n);
          }
    }
    
  6. or download this
       PRE { !defined($wordsize) || frac($wordsize)==0 }