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

How's 18?
print $ARGV[0]**.5
;-)

Replies are listed 'Best First'.
Re: Re: computing square root by hand -- no sqrt (golf, beginner)
by Juerd (Abbot) on May 10, 2002 at 22:18 UTC

    print $ARGV[0]**.5

    This is the best answer I've seen in this thread :) It's clear, short and very precise...
    How about some golfing while you're at it?

    die+shift()**.5,$/
    I know that this is 18 strokes like yours, but this one prints a newline ;)

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    


      Since you're only using one argument you can call it with one argument and shorten it to 16:
      die pop()**.5,$/
      but that's bending the rules...
      jynx
(MeowChow) Re2: computing square root by hand -- no sqrt (golf, beginner)
by MeowChow (Vicar) on May 10, 2002 at 22:44 UTC
    How's 17? The space is unnecessary.
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print