simple_statistics 0.11 → 0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/simple_statistics.rb +3 -2
- metadata +4 -4
data/lib/simple_statistics.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
|
8
8
|
class Array
|
9
9
|
def mean
|
10
|
-
self.inject(0) { |sum, x| sum += x } / self.size.to_f
|
10
|
+
self.inject(0) { |sum, x| sum += x } / (self.size.to_f)
|
11
11
|
end
|
12
12
|
def median already_sorted=false
|
13
13
|
return nil if self.empty?
|
@@ -38,7 +38,8 @@ class Array
|
|
38
38
|
self
|
39
39
|
end
|
40
40
|
def multiplier(this, previous)
|
41
|
-
|
41
|
+
return 1.0 if previous == nil || previous.to_f == 0.0
|
42
|
+
1 + ((this.to_f - previous.to_f)/previous.to_f.abs)
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 12
|
9
|
+
version: "0.12"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Craig Davidson
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-20 00:00:00 +10:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|