Code:
#include<cstdio>
#include<cmath>
int main(){
		printf("%lf\n", log(8)/log(2) );

		//case1:
		double v=log(8)/log(2);
		printf("%lld\n",(long long)v);
		
		//case2:
		printf("%lld\n",(long long)( log(8)/log(2) ));		

		//case3:
		printf("%lld\n",(long long)(double)( log(8)/log(2) ));
		
		//case4:
		printf("%lld\n",(long long)(float)( log(8)/log(2) ));		
}
output:


Code:
3.000000
3
2
2
3
Why is it not working properly while typecasting a double to long long,
but it works fine when we downcast double to float and then float to long long?