Use of log2(n) in bit manipulation

sir i was not able to understand why log2(m) is typecasted into int in the below code , as m is only power of 2 so which gives integer output itself , and why without typecasting the code is showing error .

Code -> https://sapphireengine.com/@/ltbisf

typecasting is done to convert it to the integer.
consider log2(5) its value is 2.321928
so typecasting is used…

sir but it is given in the question that m is a power of 2 always, so log will always be an integer.

can u share the ques once… i will check it

Sir i have given the code in the starting of doubt only. This code link contain the question also in the top as comment .
Code -> https://sapphireengine.com/@/ltbisf

okay… so thing is
cout<<sizeof(log2(16))<<endl;
cout<<sizeof(int(log2(16)))<<endl;

try to run both these statements… first one gives o/p 8 and second one 4…
through this we get to know that simply log2(16) is giving ans in double
while other is giving ans in int…

thus typcasting was done…

is it clear now?? shall i mark the doubt as resolved??

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.