Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Calculate NON-Integer Exponents...

Status
Not open for further replies.

onrdbandit

Programmer
Mar 12, 2003
145
US
Hello,

In my current project, I need to calculate decimal exponents. The ultimate goal is calculating Nth roots of numbers. The only methods I can find (Newton's Method and a thing working w/ Logs) both require the use of decimal exponents. These methods dont help any. To handle them, I have to calculate a decimal exponent, and if I could do this, I could simply calculate the root myself. But I dont know a function that allows for the raising of any number (preferably a double or a long double) to a non-integer power.

Does anyone know of a process or a function that can do this? I REALLY NEED THIS!

Thanks,
onrdbandit
 
try with:
pow (exponent);

exponent could be a float number

and you must include the math.h library
 
Thanks a bunch!

It works great. Somehow I managed to miss that function in the help files. The reason I tried the above methods, was because I found pow10 and pow10l. They would have been needed in the case of the above methods, but they truncate their arguments to integers, and lose the decimal value.

Thanks again,
onrdbandit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top