This gives me 0:
int B=-4;
double A = Math.Sqrt(1/B);
but this NaN
double A = Math.Sqrt(-4);
How is possible that the first calculation does not fail or at least does not return NaN as well as there is a square root of a negative number
EDIT: Thanks for the answers. I will add this one:
int B=0;
double A = 1/Math.Sqrt(B);
How come this is not the Zero divide exception?!
double
can represent the result of diving by zero as+Infinity
.