X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_graph.c;h=323fec6dcfc1ba3d0d79c455961915e8f16e9ba0;hp=594c9f6df525375f6dda0d5deea4d780c21172c2;hb=8d46034bf5b28b3c5ec94baf7d526c6a3a95fb8b;hpb=afdc1dabafc566180b57ec64c9c5504c2c8e2775 diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 594c9f6..323fec6 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -7,19 +7,19 @@ #include -/* for basename */ -#ifdef HAVE_LIBGEN_H -# include -#eles -#include "plbasename.h" -#endif - #ifdef WIN32 #include "strftime.h" #endif #include "rrd_tool.h" +/* for basename */ +#ifdef HAVE_LIBGEN_H +# include +#else +#include "plbasename.h" +#endif + #if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) #include #include @@ -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);