[GRASS-SVN] r30605 - grass/trunk/raster/r.univar2
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 17 15:26:05 EDT 2008
Author: 1gray
Date: 2008-03-17 15:26:03 -0400 (Mon, 17 Mar 2008)
New Revision: 30605
Modified:
grass/trunk/raster/r.univar2/stats.c
Log:
raster/r.univar2/stats.c (print_stats): Fixed an integer type overflow.
Modified: grass/trunk/raster/r.univar2/stats.c
===================================================================
--- grass/trunk/raster/r.univar2/stats.c 2008-03-17 16:25:17 UTC (rev 30604)
+++ grass/trunk/raster/r.univar2/stats.c 2008-03-17 19:26:03 UTC (rev 30605)
@@ -137,7 +137,7 @@
qpos_perc = (int *) G_calloc(stats->n_perc, sizeof(int));
quartile_perc = (double *) G_calloc(stats->n_perc, sizeof(double));
for (i = 0; i < stats->n_perc; i++) {
- qpos_perc[i] = (int) (stats->n * stats->perc[i] / 100. - 0.5);
+ qpos_perc[i] = (int) (stats->n * 1e-2 * stats->perc[i] - 0.5);
}
qpos_25 = (int)(stats->n * 0.25 - 0.5);
qpos_75 = (int)(stats->n * 0.75 - 0.5);
More information about the grass-commit
mailing list