From ba7bb5a48378808f5877d1b16667aeafa36d1ea4 Mon Sep 17 00:00:00 2001 From: oetiker Date: Wed, 19 Aug 2009 07:44:34 +0000 Subject: [PATCH] yes this should not matter, but I think it is the right thing todo ... git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1895 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/src/rrd_graph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 1ea457b2..323fec6d 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -4867,7 +4867,7 @@ int vdef_calc( array[step] = data[step * src->ds_cnt]; } qsort(array, step, sizeof(double), vdef_percent_compar); - field = (steps - 1) * dst->vf.param / 100; + field = round((dst->vf.param * (double)(steps - 1)) / 100.0); dst->vf.val = array[field]; dst->vf.when = 0; /* no time component */ free(array); @@ -4900,7 +4900,7 @@ int vdef_calc( } } qsort(array, nancount, sizeof(double), vdef_percent_compar); - field = (nancount - 1) * dst->vf.param / 100; + field = round( dst->vf.param * (double)(nancount - 1) / 100.0); dst->vf.val = array[field]; dst->vf.when = 0; /* no time component */ free(array); -- 2.30.2