simple_statistics 0.11 → 0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/simple_statistics.rb +3 -2
  2. metadata +4 -4
@@ -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
- previous != nil && previous != 0 ? (this.to_f/previous.to_f) : 1.0
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: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 11
9
- version: "0.11"
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-14 00:00:00 +10:00
17
+ date: 2010-06-20 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies: []
20
20