in reply to Golf  compute PI
Here's a few more methods of achieving pi:
# 39 Characters
map$x+=(1)**$_*4/(2*$_+1),0..1e6;die$x
Now, I know Ovid said no Trig functions, but I couldn't resist. Perhaps we could consider the next two examples mulligans :)
# 45 Characters
use Math::Trig;die 16*atan(1/5)4*atan(1/239)
# 21 Characters
use Math::Trig;die pi
Eric
Update: Taking some of PrakashK's suggestions, shaved off a few more characters. Thanks PrakashK! :)
# 39 Characters
map$x+=(1)**$_*4/(2*$_+1),0..1e6;die$x
Now, I know Ovid said no Trig functions, but I couldn't resist. Perhaps we could consider the next two examples mulligans :)
# 45 Characters
use Math::Trig;die 16*atan(1/5)4*atan(1/239)
# 21 Characters
use Math::Trig;die pi
Eric
Update: Taking some of PrakashK's suggestions, shaved off a few more characters. Thanks PrakashK! :)


Replies are listed 'Best First'.  

Re: Re: Golf  compute PI
by PrakashK (Pilgrim) on Apr 16, 2002 at 04:34 UTC  
by Sweeper (Pilgrim) on Apr 16, 2002 at 05:50 UTC  
(MeowChow) Re2: Golf  compute PI
by MeowChow (Vicar) on Apr 16, 2002 at 06:23 UTC  
by thospel (Hermit) on Jan 21, 2007 at 12:19 UTC 
In Section
Meditations