darkhelmet-darkext 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -9,6 +9,7 @@ test/test_darkext.rb
9
9
  test/test_helper.rb
10
10
  lib/darkext/array.rb
11
11
  lib/darkext/boolean.rb
12
+ lib/darkext/float.rb
12
13
  lib/darkext/hash.rb
13
14
  lib/darkext/integer.rb
14
15
  lib/darkext/io.rb
@@ -0,0 +1,8 @@
1
+ class Float
2
+ EPISILON = 1e-6
3
+
4
+ # Equals for floats with tolerance
5
+ def equals?(x, tolerance = EPISOLON)
6
+ (self - x).abs < tolerance
7
+ end
8
+ end
@@ -32,12 +32,3 @@ class Numeric
32
32
  Math::log10(self)
33
33
  end
34
34
  end
35
-
36
- class Float
37
- EPISILON = 1e-6
38
-
39
- # Equals for floats with tolerance
40
- def equals?(x, tolerance = EPISOLON)
41
- (self - x).abs < tolerance
42
- end
43
- end
@@ -66,6 +66,12 @@ class Array
66
66
  self.sample_variance.abs.sqrt
67
67
  end
68
68
 
69
+ def geometric_deviation
70
+ gmean = self.g_mean
71
+ Math.exp((self.map { |x| (x.ln - gmean.ln).square }.sum.to_f / self.size.to_f).sqrt)
72
+ end
73
+ alias :gstddev :geometric_deviation
74
+
69
75
  # Randomly samples n elements
70
76
  def sample(n = 1)
71
77
  (1..n).collect { self[rand(self.size)] }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darkhelmet-darkext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Huckstep
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-12 00:00:00 -08:00
12
+ date: 2009-01-18 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -52,6 +52,7 @@ files:
52
52
  - test/test_helper.rb
53
53
  - lib/darkext/array.rb
54
54
  - lib/darkext/boolean.rb
55
+ - lib/darkext/float.rb
55
56
  - lib/darkext/hash.rb
56
57
  - lib/darkext/integer.rb
57
58
  - lib/darkext/io.rb