e**x = x**0 / 0! + x**1 / 1! + x**2 / 2! + x**3 / 3! + ...
public long fact(int n)
that takes an integer n, and returns a long integer whose value is n!.
the compiler automatically creates a temporary int of equivalent value and passes this to the fact method.
double x = 2.0;
i = fact( (int) x ); //would not get a compiler error
That is, the compiler creates temporary variables of equivalent value all of the same type.
byte -> short -> int -> long -> float -> double
char -> int -> long -> float -> double
char c = 'a';
int i = 2;
float f = 3.0;
f += c - i; // c and i are promoted to float