30
May
Need Help Making A Fuction Using C In Linux To Find The 4th Root Of A Number.?
Author: admin // Category: LinuxLook at the functions in the math.h header file. On my linux distro, math.h is located in /usr/include. To get the man page on it, type in man math.h or info math.h on your terminal. Both will bring up the documentation.
Figure out just what the 4th root is and how to compute it. The math functions in math.h should help you calculate it.
Good luck.
Tags: Find, Fuction, Help, Linux, Making, Need, Number, Root, Using
May 30th, 2009 at 11:33 am
Enjoy
#include
int errno;
double log(), exp();
double
fourth_root(double arg1)
{
double arg2 = 0.25;
double temp;
long l;
if(arg1 <= 0.) {
if(arg1 == 0.) {
if(arg2 <= 0.)
goto domain;
return(0.);
}
l = arg2;
if(l != arg2)
goto domain;
temp = exp(arg2 * log(-arg1));
if(l & 1)
temp = -temp;
return(temp);
}
return(exp(arg2 * log(arg1)));
domain:
errno = EDOM;
return(0.);
}
May 30th, 2009 at 1:09 pm
can’t you just find the square root of square root?
May 30th, 2009 at 1:27 pm
Use recursion and use sqrt function to find any even root.