I am working on project in the university and I am facing a serious problem. In fact, my code is to sum over 2 variables, in order to do some staff after. As I will show below, the list is not empty, and the code extracts the values from the list, but while but it doesn't increment the counter. I will apreciate if someone could give me some help.
//CHeck if we have already imported data, if yes we use it, unless we import
if ((this.stockHistory != null) && (!(this.stockHistory.isEmpty())))
{
evolution = this.stockHistory;
}
else
{
evolution = getHostoricalData(cloned);
}
// Here I am sure the list ( evolution ) is not empty, in my case it has 63 elements
double spot ;
double sommeTendance = 0 ;
double sommeVarianceQuotidienne = 0 ;
for (int i=0;i<evolution.size()-1; i++)
{
double i1 =evolution.get(i+1) ;
System.out.println(" i1 = " + i1);
double i0 = evolution.get(i) ;
System.out.println("i0 is " + i0);
sommeTendance+= Math.log(i1/i0);
System.out.println("tendance == " +sommeTendance);
sommeVarianceQuotidienne += Math.pow(Math.log(i1/i0),2);
System.out.println("variance daily == " + sommeVarianceQuotidienne);
}
System.out.println("size == " + evolution.size());
System.out.println("total tendance == " + sommeTendance);
System.out.println("total daily variance == " + sommeVarianceQuotidienne);
And here is the last lines of the output
16:59:52,524 INFO [stdout] (default task-62) i1 = 51.619999
16:59:52,524 INFO [stdout] (default task-62) i0 is 52.73
16:59:52,524 INFO [stdout] (default task-62) tendance == NaN
16:59:52,524 INFO [stdout] (default task-62) variance daily == NaN
16:59:52,524 INFO [stdout] (default task-62) i1 = 53.330002
16:59:52,524 INFO [stdout] (default task-62) i0 is 51.619999
16:59:52,525 INFO [stdout] (default task-62) tendance == NaN
16:59:52,525 INFO [stdout] (default task-62) variance daily == NaN
16:59:52,525 INFO [stdout] (default task-62) size == 63
16:59:52,525 INFO [stdout] (default task-62) total tendance == NaN
16:59:52,525 INFO [stdout] (default task-62) total daily variance == NaN