
noninterger exponents
Is there any way to use fractional exponents? I've tried:
Code:
pow(base, exponent);
with exponent being 1.2 or so and I've also tried a roundabout way to get the answer using:
Code:
pow10(log10(base)*exponent);
and all it seems to do is convert the exponent to a int and then do the math. And also I am using doubles for all my variables.

Write your own exponent function :)
If the function only takes ints for arguments then you cant pass numbers with decimal points...

hmm...
that's weird. it worked for me.
pow takes two double arguments and returns a double. it should work.
what compiler?

I'm using the Borland Command Line Compiler (not sure what version, think it's pretty recent.) And I tried hard coding an example: Code:
cout<<pow10(1.2)<<' '<<pow10(.3);
and it printed: 10 1
And on the reply of me writing my own function, I'm not quite sure how to do that without using Log or 10^X. :) Haven't quite covered that in precal.

write a power series for the power function and have a certain level of precision, if you want to write your own power function. For more information look on the net for power series.
LC

Works for me
Code:
#include <iostream>
#include <cmath>
using namespace std;
int main ( ) {
cout<<pow10(1.2)<<' '<<pow10(.3) << endl;
return 0;
}
Produces
15.8489 1.99526