|
C[jj] = a0 + a1 * dx + a2 * dx * dx + a3 * dx * dx * dx; |
This looks like a bug. The very first time when {i,j,k,jj}={0,0,0,0} only C[0] is calculated while C[1], C[2], C[3], C[4] are uninitialized. But later in the code d0, d2, d3 and a0 are calculated using C[1], C[2], C[3], C[4]!