Hello,
it looks like you are writing 32 bit code. Then long is 4 byte and double is 8 byte.
Look at your operation:
den = ((factorial(p))*i);
-> double = long * int
i will be converted to long. The result of the multiplication will be long again. Then you cast it to 8 byte double.
"long * long" can easily overflow. The compiler recognizes that you cast the result to 8 byte double, so that's why the compiler warns you.
Use this coding instead:
den = (double)factorial(p) * i;
-> long and int will be casted to double first. The multiplication will now operate on 8 byte doubles instead of 4 byte longs.
Regards, Guido