I know that floating point variables loose precision while casting. But what I don't understand is, why a cast from a smaller primitive to a bigger one is unprecise but vice versa not. I would understand if it happens from double to float but it's the other way around. Why is this so?

See the results from these two tests:

```
@Test
public void castTwoPrimitiveDecimalsUnpreciseToPrecise()
{
    float var1 = 6.2f;
    double var2 = var1;

    assertThat(var2, is(6.2d)); //false, because it's 6.199999809265137
}

@Test
public void castTwoPrimitiviesDecimalsPreciseToUnpresice()
{
    double var1 = 7.6d;
    float var2 = (float)var1;

    assertThat(var2, is(7.6f)); //true
}

```