I suspect that HoBzY's confusion stems from the term
nBits.
The term comes from the name of the variable in the code and it does not stand for "number of bits" or "the bits associated with the value N".
Satoshi used a (mostly deprecated) variable naming scheme invented at Microsoft called
Hungarian Notation. In this scheme, the name of a variable is prefixed by a symbol that represents the variable's type. In the case of
nBits, the prefix is
n, which says that the variable is a signed integer.
So, the name
nBits indicates that it represents "bits" in the form of an integer.
It is a poorly named variable in my opinion, since
bits says nothing about what the variable represents and it isn't even an integer.
I always thought the "n" stood for number. I guess most programmers and even AIs (by consequence of analyzing these programmers' input) think of it that way as well.
Regardless, floats are not used for this kind of calculation by Bitcoin Core. I heard they have a wide 256-bit int type which they adapt to store all the precision of numbers without requiring any decimal places.