Hey,
I hope I'm able to explain my programming issue clearly:
I have written a solver for differential equations.
Now I solved it, with different initial conditions, which are calculated within several loops; for instance:
1 2 3 4 5
|
for(double value_a = a1; a <= a2; a+=2.2E-20*a_steps){
for(double value_b = b1; b <= b2; b+=2.2E-20*b_steps){
function_to_solve_my_differential_equation(value_a,value_b,...);
}
}
|
Then I store the data of the solved differential equation; with the remark which initial conditions I have used to solve it:
Solution with initial conditions:
a_value = 2.343234443243E-16 (e.g.)
b_value = 2.876344242354E-13 (e.g.)
... huge amount of data ...
... huge amount of data ...
...........................
|
Suppose, I want to reproduce my data again: I solve my differential equation again with the initial conditions, which I had printed out in the data-file I produced before:
|
function_to_solve_my_differential_equation(2.343234443243E-16, 2.876344242354E-13,...)
|
But, surprise, then the "huge amount of data" I get is not _exactly_ the same as before!
I very, very strongly assume, that the problem is, that the printed initial conditions (a_value, b_value) are not "exactly" the "internal", "exact" ones, with which my differential equation is solved, although I printed them out with "precision(16)", cause double should be exact to - more or less - 16 decimals...
I think that's why after many loops, the numerical inacurracy of conversion between decimal to "internal" binary representation accumulates.
I hope I explained my problem clearly: I want to output the initial conditions produced by the two for-loops "exactly", so that i can call my differential-equation-solver again, to reproduce the data I got via going through the initial conditions within the loops.
I tried to store the initial values produced by the loops as binary data, but that is very, very unpracticable for my needs.