Most likely a really simple question, please keep any answers easy to understand I'm still quite new at this:
I'm making a little app, and I need to use powers for a couple of calculations. After a little research I found the pow function in cmath, and have had a play. In the end i came up with this snipped, which works:
#include <iostream>
#include <cmath>
using namespace std;
int main ()
{
float dummy2, test(6.65);
dummy2 = (float) pow((float) 3.57, test);
cout << dummy2;
return 0;
}
and it returns the correct answer (4734.17), but only to two decimal places. I want 5 decimal places preferably.
What did I do wrong here? Am I using the wrong data type (floats)? Or is it a limit of whatever is in the pow function to using only 2dp?
I could, if it came to it just define constants with the values i want, since it's only going to be 4 or 5 sums that I need this precision on, but if it's possible to have the program calculate it that would be great.
Thanks