We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d3b120 commit 1b0fde1Copy full SHA for 1b0fde1
ModelicaByExample/Functions/Interpolation/source/VectorTable.c
@@ -76,8 +76,8 @@ interpolateVectorTable(void *object, double x) {
76
ModelicaFormatError("Requested value of x=%g is above the upper bound of %g\n",
77
x, table->x[table->npoints-1]);
78
79
- while(x>=table->x[i+1]) i = i + 1;
80
- while(x<table->x[i]) i = i - 1;
+ while(i<table->npoints-1&&x>table->x[i+1]) i++;
+ while(i>0&&x<table->x[i]) i--;
81
82
p = (x-table->x[i])/(table->x[i+1]-table->x[i]);
83
table->lastIndex = i;
0 commit comments