X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_graph.c;h=f04a2b3017ae855061c3e1e9b07726cc247c0ae8;hp=b624171c6860c0d309c59e265e92a634846b14e8;hb=40cc8b00296079815f08c2ff55f134efae83ea69;hpb=4711139e9d9dae2bd34ce56bf1e77778d375c5fb diff --git a/src/rrd_graph.c b/src/rrd_graph.c index b624171..f04a2b3 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -4431,19 +4431,19 @@ int vdef_calc( if (dst->vf.op == VDEF_TOTAL) { dst->vf.val = sum * src->step; dst->vf.when = 0; /* no time component */ - } else if (dst->vf.op == VDEF_AVERAGE){ + } else if (dst->vf.op == VDEF_AVERAGE) { dst->vf.val = sum / cnt; dst->vf.when = 0; /* no time component */ } else { average = sum / cnt; sum = 0.0; - for (step=0;stepds_cnt])) { - sum += pow((data[step*src->ds_cnt] - average),2.0); + for (step = 0; step < steps; step++) { + if (finite(data[step * src->ds_cnt])) { + sum += pow((data[step * src->ds_cnt] - average), 2.0); }; } - dst->vf.val = pow(sum / cnt,0.5); - dst->vf.when = 0; /* no time component */ + dst->vf.val = pow(sum / cnt, 0.5); + dst->vf.when = 0; /* no time component */ }; } else { dst->vf.val = DNAN;