com_measure2.c, add checks for NAN to the measure functions

to enable 'measure' for clipped vectors
This commit is contained in:
h_vogt 2017-04-30 23:17:25 +02:00
parent 3f96807632
commit 2bcd011553
1 changed files with 25 additions and 0 deletions

View File

@ -436,6 +436,11 @@ com_measure_when(
scaleValue = dScale->v_realdata[i];
}
/* check for NAN */
if (isnan(value))
continue;
/* end of check */
if (has_d2) {
if (ac_check) {
if (d2->v_compdata)
@ -450,6 +455,11 @@ com_measure_when(
} else {
value2 = d2->v_realdata[i];
}
/* check for NAN */
if (isnan(value2))
continue;
/* end of check */
} else {
value2 = NAN;
}
@ -668,6 +678,11 @@ measure_at(
svalue = dScale->v_realdata[i];
}
/* check for NAN */
if (isnan(value))
continue;
/* end of check */
if ((i > 0) && (psvalue <= at) && (svalue >= at)) {
meas->m_measured = pvalue + (at - psvalue) * (value - pvalue) / (svalue - psvalue);
return;
@ -764,6 +779,11 @@ measure_minMaxAvg(
svalue = dScale->v_realdata[i];
}
/* check for NAN */
if (isnan(value))
continue;
/* end of check */
if (dc_check) {
/* dc: start from pos or neg scale value */
if ((svalue < meas->m_from) || (svalue > meas->m_to))
@ -934,6 +954,11 @@ measure_rms_integral(
xvalue = xScale->v_realdata[i];
}
/* check for NAN */
if (isnan(value))
continue;
/* end of check */
if (xvalue < meas->m_from)
continue;