Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: [Study]: Searching for square roots

by Hofmator (Curate)
on Nov 14, 2006 at 14:17 UTC ( #583968=note: print w/replies, xml ) Need Help??


in reply to Re: [Study]: Searching for square roots
in thread [Study]: Searching for square roots

Nothing is totally wrong :)

The only thing that you did not consider is that x*x < x for x < 1. That's why your code doesn't work for input < 1.

Apart from that a couple of small comments concerning your code.

  • Don't use prototypes for your subroutines unless you know exactly what you are doing.
  • Don't use the variables $a and $b, they are special and used for sort.
  • Instead of writing my ($x, $y, $z) = (shift, shift, shift); simply write my ($x, $y, $z) = @_;.

-- Hofmator

Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://583968]
help
Chatterbox?
marioroy Updated Re^3: RFC: Compiling Gtk+ stack on windows with strawberry perl. Also tested Gtk2 installation on Strawberry Perl v5.22.3.1. Installing Tk and Tk::Zinc works fine on Perl v5.22.3.1.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-09-24 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (273 votes). Check out past polls.

    Notices?