Name: Eamon 2012-08-28 19:39
Why is this line ok:
long double x = (1 / sqrt(2));
but this one isn't:
long double x = (1 / 4);
?
long double x = (1 / sqrt(2));
but this one isn't:
long double x = (1 / 4);
?
sqrt returns a double so the whole expression is a double. The other one is an integer division because the compiler infers that both operands are int.