I have a double which is:
double mydouble = 10;
and I want 10^12, so 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10. I tried
double newDouble = pow(10, 12);
and it returns me in NSLog: pow=-1.991886
makes not much sense… I think pow isn’t my friend right?
try pow(10.0, 12.0). Better yet,
#include math.h.To clarify: If you don’t include math.h, the compiler assumes that
pow()returns an integer. Including math.h brings in a prototype likeSo the compiler can understand how to treat the arguments and the return value.