Pow() function takes double datatype as arguement

can power function takes only double as argument in c++, Should we typecast into int. Can you give me example when it is failing in int.
As gfg article is saying that you have to type cast a pow() while using for int.https://www.geeksforgeeks.org/power-function-cc/
when i am doing pow(5,2) it is giving me correct output which is 25.

@mukuuu it has been mentioned in the article that it is dependant on the compiler, sometimes it may give correct answer sometimes it may not, so it is better to be on the safe side. The example where it might fail for int has also been given in that article itself. It is called the floating-point error and you can read more about it if you are interested in that.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.