aggregate_afurmanov 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/aggregate_afurmanov.gemspec +2 -2
- data/lib/aggregate.rb +9 -6
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/aggregate_afurmanov.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{aggregate_afurmanov}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joseph Ruscio, Aleksandr Furmanov"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-09}
|
13
13
|
s.description = %q{Aggregate is a Ruby class for accumulating aggregate statistics and includes histogram support. For a detailed README see: http://github.com/josephruscio/aggregate}
|
14
14
|
s.email = %q{aleksandr.furmanov@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/aggregate.rb
CHANGED
@@ -209,6 +209,11 @@ class Aggregate
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
|
212
|
+
# log2(x) returns j, | i = j-1 and 2**i <= data < 2**j
|
213
|
+
@@LOG2_DIVEDEND = Math.log(2)
|
214
|
+
def self.log2( x )
|
215
|
+
Math.log(x) / @@LOG2_DIVEDEND
|
216
|
+
end
|
212
217
|
private
|
213
218
|
|
214
219
|
def linear?
|
@@ -273,7 +278,7 @@ class Aggregate
|
|
273
278
|
# A data point is added to the bucket[n] where the data point
|
274
279
|
# is less than the value represented by bucket[n], but greater
|
275
280
|
# than the value represented by bucket[n+1]
|
276
|
-
|
281
|
+
|
277
282
|
def to_index (data)
|
278
283
|
|
279
284
|
# basic case is simple
|
@@ -288,11 +293,9 @@ public
|
|
288
293
|
#Should not get here
|
289
294
|
raise "#{data}"
|
290
295
|
end
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
def log2( x )
|
295
|
-
Math.log(x) / @@LOG2_DIVEDEND
|
296
|
+
|
297
|
+
def log2(x)
|
298
|
+
self.class.log2(x)
|
296
299
|
end
|
297
300
|
|
298
301
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aggregate_afurmanov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joseph Ruscio, Aleksandr Furmanov
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-09 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|