How are following two lines of code different?

they are giving different answers in a submission…

solved = (long long int)floor((float)N/A) + (long long int)floor((float)N/B) - 2*(long long int)floor((float)N/(A*B/__gcd(A, B)));

solved = N/A + N/B - 2*(N / (A*B/__gcd(A, B)));

it may be due to precision and rounding of floating point numbers.

it will be different only if N,A and B are declared as long long int or int type because division is required in float.