changeset f5742240963f in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=f5742240963f
description:
        stats: Fix off-by-one error in distributions.

        bkt size isn't evenly divisible by max-min and it would round down,
        it's possible to sample a distribution and have no place to put the 
sample.
        When this case occured the simulator would assert.

diffstat:

 src/base/statistics.hh |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r ef798deb9a02 -r f5742240963f src/base/statistics.hh
--- a/src/base/statistics.hh    Sun Aug 22 18:42:23 2010 -0700
+++ b/src/base/statistics.hh    Mon Aug 23 11:18:39 2010 -0500
@@ -2287,7 +2287,7 @@
         params->min = min;
         params->max = max;
         params->bucket_size = bkt;
-        params->buckets = (size_type)rint((max - min + 1.0) / bkt );
+        params->buckets = (size_type)ceil((max - min + 1.0) / bkt);
         this->setParams(params);
         this->doInit();
         return this->self();
@@ -2352,7 +2352,7 @@
         params->min = min;
         params->max = max;
         params->bucket_size = bkt;
-        params->buckets = (size_type)rint((max - min + 1.0) / bkt);
+        params->buckets = (size_type)ceil((max - min + 1.0) / bkt);
         this->setParams(params);
         this->doInit(size);
         return this->self();
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to