Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Golf -- compute PI

by PrakashK (Pilgrim)
on Apr 16, 2002 at 04:34 UTC ( #159413=note: print w/ replies, xml ) Need Help??


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

# 23 Characters
use Math::Trig;warn pi;
Why warn, when you can die saving one more character?
# 22 Characters use Math::Trig;die pi;
And, you can shave one more character, if you don't care for that pesky semi-colon at the end.

Oh, never mind. We are not supposed to use trig functions.

/prakash


Comment on Re: Re: Golf -- compute PI
Select or Download Code
Replies are listed 'Best First'.
Re: Re: Re: Golf -- compute PI
by Sweeper (Pilgrim) on Apr 16, 2002 at 05:50 UTC
    You can get the same result with 20 chars:
    die 3.14159265358979
    
    I found this trick in Logique, informatique et paradoxes, publisher Belin (Pour la Science), page 67, it was about the shorter program to get (not compute) pi with n digits.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2015-07-07 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls