Permalink
Browse files

Correctly determine the bucket for a timestamp equals to max, close #891

  • Loading branch information...
Grégory Coutant
Grégory Coutant committed Jan 2, 2013
1 parent db7ccea commit 33aab9e3ac5772f06f11b367a49afc76339df4d9
@@ -28,8 +28,8 @@ object StatsHelper {
}
def bucket(t: Int, min: Int, max: Int, step: Double, halfStep: Double): Int = {
- if (t >= max) math.round((max - halfStep)).toInt
- else math.round((t - (t - min) % step + halfStep)).toInt
+ val value = t min (max - 1)
+ math.round((value - (value - min) % step + halfStep)).toInt
}
def square(x: Double) = x * x

0 comments on commit 33aab9e

Please sign in to comment.