double p = PeriodComponents.GetPeriod()
double P = (1/(sqrt(2*3.1415)*.69*p))^(-(1/(2*.69^2))((log (p))-log (5))^2)
In this section of code I define a variable 'p', the function you see gets me a random number between 0,1. I then want to modify that number by the equation you see above. But I am getting a lot of "log" related errors.
On the line with the logs I am getting 2 errors.
Error c2296: '^' : illegal, left operand has type double.
Error C2668: 'log' L ambiguous call to overloaded function.
I don't understand why either of these is illegal. And I don't know what it means by an ambiguous call to overloaded function. If someone could help me fix this code, I'd be very much appreciative.
Operator ^ is not "to the power of": In C++ it means bitwise XOR. You need to use pow(base, exponent). The pow() function is in cmath, which I suppose you are already using because it is also where log() is.
As for log(), you need to resolve the ambiguous calls. The error message usually tells you all overloaded possibilities. Decide on which one you want to use and then do an explicit cast.
Are you trying to use ^ as a power operator? If so, then I think I should let you know that it's not that in C++; it's a bitwise XOR. :/
Did you mean to use pow(), by any chance? http://cplusplus.com/reference/clibrary/cmath/pow/
As for the second one, the problem is that a logarithm is supposed to take a floating point number as input. Thus, it gets confused when you try to call it with an integer, like you did here: ...-log (5))...
If you change your numbers to their floating-point equivalents, then I think the issue will be resolved.