long double pow

closed account (zbREy60M)
I am having an error type within my pow() function. Please help! Last line of code shown.
1
2
3
4
5
6
7
8
9
10
long double p = abs (PeriodComponents.GetPeriod()); //to be calculated; p and P are measured in seconds
long double prefrequency = 2.0 / p;
//WARNING:E is the  NOT mathematical constant e.
//It is the const var of ellipticity
long double Ellipse2=Ellipse*Ellipse;
const long double pi=3.1415926535897932384626433832795,
	pi4=pi*pi*pi*pi,
	G=6.673E-11;
long double divisor= 32.0 * pi4 * G * 1E+45 * Ellipse2 * a;
long double postfrequency = pow( pow(prefrequency,-4.0) + 6E+9 / divisor, -.25 );


error C2666: 'pow' : 6 overloads have similar conversions
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(575): could be 'long double pow(long double,int)'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(573): or 'long double pow(long double,long double)'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(527): or 'float pow(float,int)'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(525): or 'float pow(float,float)'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(489): or 'double pow(double,int)'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(123): or 'double pow(double,double)'
1> while trying to match the argument list '(long double, double)'

You have tried to use the version of pow that accepts a long double and a double.

Sadly, there is no such function, and the compiler has too many choices as to what you might have meant, so is unable to cast the double for you.

Pick one of those pow functions in the error messages, and cast your data so that you calling it.

For example, you might decide to use the one that accept a long double and a float, and then code something like:

1
2
3
float value = -4.0;
...
pow(prefrequency,value)... 
Last edited on
closed account (zbREy60M)
I did exactly what you just said, but still got the same error message. I also attempted to just put the number "-4" in there, since that would be an int, but I still get the same error message. I had already realized the fix you suggested, which is why I am so confused by what is happening.
Break the line with the two calls to pow into two separate statements so you can see which one is actually causing the problem; it could be that -0.25 is the double in question.
Last edited on
Topic archived. No new replies allowed.