0.1 in 32-bit single precision: sign=0, exponent=-4 (biased 123), class = Normal.
In 32-bit format the stored value differs from your input by 1.490116e-9. This is floating-point rounding in action.
64-bit double precision stores the value with far greater accuracy (about 15-17 significant decimal digits vs. 7 for 32-bit).
Binary fractions can only represent numbers whose denominator is a power of 2. Values like 0.1 and 0.3 repeat infinitely in binary, causing the small rounding errors you see.
The hexadecimal encodings are: 32-bit = 0x3DCCCCCD, 64-bit = 0x3FB999999999999A.
Next stepUse 64-bit doubles for general computation and reserve 32-bit floats for GPU shaders or large float arrays where memory matters.