in reply to Re: Calculating Nth root using perl.
in thread Calculating Nth root using perl.

your code is not going to generate any error when $y < 0. That's usually a very bad thing!

Just

$x = $y ** (1/4);
is better!

Replies are listed 'Best First'.
Re^3: Calculating Nth root using perl.
by ikegami (Patriarch) on May 09, 2006 at 18:34 UTC
    I agree (++). Error handling shouldn't be removed without being replaced. Either handle it (by throwing an exception, displaying a warning, returning a complex number, returning an error code, etc) or let Perl handle it (by dying).