private void fillInState() {
state [0][0] = 0.6;
state [0][1] = 0.4;
state [1][0] = 0.3;
state [1][1] = 0.6;
state [1][2] = 0.1;
state [2][0] = 0.7;
state [2][2] = 0.3;
}
private void fillInNext() {
next [0][0] = 1.0;
}
public void chain (int time) {
for(int i=0; i<time;i++) {
for( int j=0; j<3;j++) {
double temp = 0;
for(int k=0;k<3;k++) {
temp = state[k][j] * next [k][i] + temp;
if(k==2) {
next[j][i+1]=temp;
}
}
}
}
}
The expected answer should be:
1.0 0.6 0.48
0.0 0.4 0.48
0.0 0.0 0.04
But the answer in blueJ is:
1.0 0.6 0.48
0.0 0.4 0.48
0.0 0.0 0.04000000000000001
Anyone knows what happened? Is that about the Double class or blueJ?