title: Why can you store a long into a float without typecast
body: <p>Ok so I know float is 32 bit decimal. Double is 64 bit decimal. Long is 64 bit whole number. So why is this value: Float(32 bit) &lt;- Long (64 bit). Obviously not java code but I'm referring to it in java. It automagically casts even though it crunches it into 32 bits and loses precision. So that means precision does not matter. However int &lt;- double does not work unless you explicitly cast the double to an int. It is a smaller size and they are both numbers and both primitives. Is it just the general rule: Decimal Number &lt;- Whole number regardless of bit size. It will just loop back around. Just that rule and everything works among Numbers in java? To show actual code:</p>
  
  <pre><code>long L = 10_000L;
  float f = L;
  </code></pre>
  
  <p>Note that the question is specifically about <code>long</code> to <code>float</code> without an explicit cast, not <code>float</code> to <code>long</code>, not about explicit casting.</p>