P is for Practical | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
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! :-) In reply to Re: Golf -- compute PI
by andreychek
|
|