Help for this page

Select Code to Download


  1. or download this
    #use bignum "a", 32; # uncomment for greater precision
    $x = 2**(1/12); # change this to any number you like
    ...
    $n = int(($p - $x*$q) / ($x*$s - $r)); ($p, $q) = ($p + $n*$r, $q + $n
    +*$s); print $p, "/", $q, " = ", $y = $p/$q, "\n"; $y == $x and last; 
    $n = int(($r - $x*$s) / ($x*$q - $p)); ($r, $s) = ($r + $p*$n, $s + $q
    +*$n); print $r, "/", $s, " = ", $y = $r/$s, "\n"; $y == $x and last; 
    redo; }