I have a question about an error when translating the pseudo code below into Java. There is no problem with the loss of accuracy because of truncation but a programming language issue that I can't seem to find.
I though the answer would be that the result of Math.pow()
would be too much for a double (range from 4.94065645841246544e-324d
to 1.79769313486231570e+308d
. But apparently there is more wrong and I can't see it.
PSEUDO CODE
x = 7.0
y = x^1000.0
n = y truncated to an integer
converted to
JAVA
double x, y;
int n;
x = 7.0;
y = Math.pow(x,1000.0);
n = (int)y;
Much appreciated, I'd really like to understand the issues here.