Help for this page

Select Code to Download


  1. or download this
    sub continued_fraction {
        my ($a, $b, $n) = (@_[0,1], $_[2] // 100);  
    #<========= what is $_[2] // 100 ??
    ...
    printf "e   &#8776; %.9f\n", continued_fraction do { my $n; sub { $n++
    + || 2 } }, do { my $n; sub { $n++ || 1 } }; # <===== Note there is no
    + third arg passed
    printf "&#960;   &#8776; %.9f\n", continued_fraction do { my $n; sub {
    + $n++ ? 6 : 3 } }, do { my $n; sub { (2*$n++ + 1)**2 } }, 1_000; #<==
    +== Here there is a 3rd arg
    printf "&#960;/2 &#8776; %.9f\n", continued_fraction do { my $n; sub {
    + 1/($n++ || 1) } }, sub { 1 }, 1_000; #<==== Here there is a 3rd arg