title: C++, very unexpected -1#INF
body: <p>I am debugging optimization routine. I produce a log text file where I track objective function value at each iteration in optimization routine.</p>
  <p>Here is the context: I work with a curve fitting problem, with a model that is linear in the four parameter, and polynomial in the X data</p>
  <pre><code>Y = PARAM1*X^3+PARAM2*X^2+PARAM3*X+PARAM4
  </code></pre>
  <p>and I run optimization routine on unnoised unbiased data generated from this model so as to test the algorithm.</p>
  <p>In log file, first optimization step show no problem. Function evaluations have a double value. At each iteration, 5 function values are calculated (and displayed in log file). From a given iteration, things turn sour: one function evaluation becomes <code>-1#INF</code> although objective function has already been successfully evaluated at this very point (!). In the next iterations, the 'bad point' keeps evaluating at <code>-1#INF</code>, and one by one other points also end up evaluated at -1#INF. The calculation of Y at these points is no struggle given the formula and given the fact that they were properly evaluated before.</p>
  <p>Also, I suspect another cause, like memory management. Would you have any idea about this, or any advice to track the problem closer?</p>
  <hr />
  <h1>Edit</h1>
  <p>I see the first occurrence of <code>-1#INF</code> in log file. Function is evaluated at 5 points at each iteration, but only one of those 5 points is a 'new point'. When <code>-1#INF</code> first appears, function has already been successfully evaluated at this point.</p>
  <p>It looks like</p>
  <pre><code>ITERATION N-1
  f1 559.011
  f2 560.034
  f3 562.034
  f4 560.342
  f5 560.344
  
  ITERATION N 
  f1 -1#INF
  f2 560.034
  f3 558.034
  f4 560.342
  f5 560.344
  </code></pre>
  <p>where at <code>ITERATION N</code> only <code>f3</code> is a function evaluation at a new point, and f1 is the function evaluation at the same point than is f1 in <code>ITERATION N-1</code>.</p>