Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Golf -- compute PI

by blakem (Monsignor)
on Apr 17, 2002 at 06:41 UTC ( [id://159727]=note: print w/replies, xml ) Need Help??


in reply to Re: Golf -- compute PI
in thread Golf -- compute PI

You could use $\ instead, which will trim the two chars at the expense of an 'uninitialized' warning....
$n=3;$s=1;for(1..9){$n*=2;$s=(2-(4-$s**2)**.5)**.5;$\=$n*$s}print
Infact, if you rearrange things and toss in a little obfu, you can trim a few more chars. It even has the side-effect of making it strict compliant:
$@=3;$;=1;$@*=2,$;=(2-(4-$;**2)**.5)**.5,$\=$@*$;for 1..9;print

-Blake

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found