in src/main/java/net/hydromatic/linq4j/expressions/Expressions.java [1446:1469]
private static Type larger(Type type0, Type type1) {
// curiously, "short + short" has type "int".
// similarly, "byte + byte" has type "int".
// "byte / long" has type "long".
if (type0 == double.class
|| type0 == Double.class
|| type1 == double.class
|| type1 == Double.class) {
return double.class;
}
if (type0 == float.class
|| type0 == Float.class
|| type1 == float.class
|| type1 == Float.class) {
return float.class;
}
if (type0 == long.class
|| type0 == Long.class
|| type1 == long.class
|| type1 == Long.class) {
return long.class;
}
return int.class;
}