#include <sys/stat.h>
-/* for basename */
-#ifdef HAVE_LIBGEN_H
-# include <libgen.h>
-#eles
-#include "plbasename.h"
-#endif
-
#ifdef WIN32
#include "strftime.h"
#endif
#include "rrd_tool.h"
+/* for basename */
+#ifdef HAVE_LIBGEN_H
+# include <libgen.h>
+#else
+#include "plbasename.h"
+#endif
+
#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
#include <io.h>
#include <fcntl.h>
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);
}
}
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);