Arithmetic limitations

Expect the unexpected:

Figure 102. Strange things I Slide presentation
byte count = 91;   // o.K.

int i = 91;

byte count2 = i;   // Compile error: Incompatible types
                   // Required: byte Found: int

byte points = 130; // Compile error: Incompatible types
                   // Required: byte Found: int

Figure 103. Strange things II Slide presentation
final int i = 91;

byte count = i;   //  o.K.

Why not generally using float / double in favour of seemingly more limited byte, short, int, long for arithmetics?

Figure 104. Limited floating point arithmetic precision Slide presentation
Code
long longValue = 1000000001L;

float fValue = longValue;
System.out.format(" float value: %19.0f\n",  fValue * fValue);

double dValue = longValue;
System.out.format("double value: %19.0f\n", dValue * dValue);

IO.println(" Exact value: " + longValue * longValue);
Result
 float value:  999999984306749400
double value: 1000000002000000000
 Exact value: 1000000002000000001

Figure 105. Nearest float to 0.1F Slide presentation
Code
// Trying to represent 0.1F
// Meaning of »%12.10f«: Print 10 fractional digits
// within a 12 character field

System.out.format(
   "%12.10f\n",
   Float.intBitsToFloat(0b111101110011001100110011001100));
                            //                         
                            //                         
                            // There is no value in between
System.out.format(          //                         
   "%12.10f\n",             //                         
   Float.intBitsToFloat(0b111101110011001100110011001101));
Result
2.099999905 (too small)
2.100000143 (too big)

Figure 106. FloatConverter Slide presentation
FloatConverter