Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Golf -- compute PI

by Ovid (Cardinal)
on Apr 16, 2002 at 00:18 UTC ( [id://159377]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    #Compute pi. Based on Leibniz's algorithm that
    ...
            };
            return $sub;
    }
    
  2. or download this
    $p=4;$n=l();for(1..100000){($s,$a)=&$n;$p=$p-$s+$a}print$p;
    sub l{$i=1;sub{$i+=2;$f=4/$i;$i+=2;$q=4/$i;($f,$q)}}
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://159377]
Approved by ChemBoy
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-04-18 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found