Link to home
Start Free TrialLog in
Avatar of java_gurl
java_gurl

asked on

nth root in Perl?

Hi,

I want to get the nth root of a number in perl. I know the squared root function exists but i need to perform an operation that requires the nth root.

thanks

java gurl

*the girl of your dreams*
Avatar of pjedmond
pjedmond
Flag of United Kingdom of Great Britain and Northern Ireland image

Easy:)
--------------------------X8---------------------
#!/usr/bin/perl

my $number=8;
my $nth_root=3;

$log_e = log($number);
$answer=exp ($log_e/$nth_root);

print "$nth_root th root of $number is $answer\n";
--------------------------X8---------------------
ASKER CERTIFIED SOLUTION
Avatar of pjedmond
pjedmond
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of java_gurl
java_gurl

ASKER

thanks a million!