Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: computing square root by hand -- no sqrt (golf, beginner)

by jynx (Priest)
on May 09, 2002 at 20:03 UTC ( #165486=note: print w/ replies, xml ) Need Help??


in reply to Re: computing square root by hand -- no sqrt (golf, beginner)
in thread computing square root by hand -- no sqrt (golf, beginner)


a reinterpretation of japhy's solution gives 54:

$_=pop;$l^$_?$l=$_:die"$_\n"while$_=($_+$ARGV[0]/$_)/2
jynx

update: this works at 53:

$_=pop;$l^$_?$l=$_:die"$_\n"while($_+=$ARGV[0]/$_)/=2
update2: using the comma instead of quotes for die it's 52:
$_=pop;$l^$_?$l=$_:die$_,$/while($_+=$ARGV[0]/$_)/=2


Comment on Re: Re: computing square root by hand -- no sqrt (golf, beginner)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2015-05-24 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (475 votes), past polls