oddity = 7 / 3.0;
Sys.println("oddity = " + oddity);
oddity = 7 / 3;
Sys.println("oddity = " + oddity);
oddity *= 2;
Sys.println("oddity = " + oddity + " // Note that the value right of the decimal is lost.");
oddity = 5 / 3.0;
Sys.println("oddity = " + oddity + " // Proving that division will always round down.");
oddity = 5 / 3;
Sys.println("oddity = " + oddity);
oddity = 5 / 3.toFloat();
Sys.println("oddity = " + oddity + " // Have to add toFloat() to at least one of the variables to ensure precision.");
oddity = 2.333333
oddity = 2
oddity = 4 // Note that the value right of the decimal is lost.
oddity = 1.666667 // Proving that division will always round down.
oddity = 1
oddity = 1.666667 // Have to add toFloat() to at least one of the variables to ensure precision.
So as you can see division will round down when passed 2 ints.