C++ performs integral-to-floating conversion and integrals in the analogRead() range are properly represented as float, there is no loss of information.
u is a global with a non-constant initializer (a function call), so it undergoes what is called dynamic initialization (the compiler cannot set the value at compile time in flash memory as it would with a constant), which the compiler arranges to happen at runtime during a generated startup sequence, before main() is entered.
The startup code runs the dynamic initialization of globals first, then calls main(). On Arduino, main() then calls init(), then setup(), then enters the loop() cycle. The init() call is what configures the timers, the ADC prescaler, and other hardware needed for analogRead() to function.
The problem is the ordering: u's initializer fires during the startup sequence, before main() runs and therefore before init() configures the ADC. So when analogRead(1) is called to initialize u, the ADC hardware has not yet been set up.
The practical consequence is that u gets possibly initialized with a garbage or meaningless reading, not a valid measurement from pin A1. The call doesn't crash, but the value is unreliable, just some artifact of the possibly uninitialized ADC state.
@tom321 β move that in setup, it will be called post initialization of the hardware and then the value will be reliable.
formal reasoning is better than just one example :)
A 32-bit float (IEEE 754) has a 23-bit mantissa, but with the implicit leading 1 bit it carries 24 bits of integer precision β meaning it can represent every integer exactly up to 2^24, which is 16,777,216.
analogRead() on an Arduino returns a 10-bit value: 0 to 1023 (or 4095 on some). That is nowhere near 16 million, so every integer in that range maps to an exact float representation. The mantissa has more than enough bits to hold it without rounding. No information is lost in the conversion.
If you were reading, say, a 32-bit sensor value, the story would be very different β integers above 16,777,217 start losing their least significant bits as the float can no longer represent them exactly, and you would need a real double (53-bit mantissa, exact up to 2^53) or stay in integer arithmetic entirely.