fibon 0.0.5 → 0.0.6

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.
@@ -29,5 +29,29 @@ module Fibon
29
29
 
30
30
  value
31
31
  end
32
+
33
+ def self.nearest(x)
34
+ i = 0
35
+ value = 0
36
+
37
+ below = 0
38
+ above = 0
39
+
40
+ while x > above
41
+
42
+ i = i + 1
43
+ below = above
44
+ above = Fibon.place(i)
45
+
46
+ end
47
+
48
+ if x-below > above - x
49
+ value = above
50
+ else
51
+ value = below
52
+ end
53
+ value
54
+
55
+ end
32
56
 
33
57
  end
@@ -7,8 +7,10 @@ module Fibon
7
7
 
8
8
  def self.check(a)
9
9
  value = false
10
+
10
11
  firstcheck = (5*(a**2))+4
11
12
  secondcheck = (5*(a**2))-4
13
+
12
14
  if (self.isPerfectSquare(firstcheck) == true) or (self.isPerfectSquare(secondcheck) == true)
13
15
  value = true
14
16
  else
@@ -27,5 +29,32 @@ module Fibon
27
29
 
28
30
  value
29
31
  end
32
+
33
+ def self.nearest(x)
34
+ i = 0
35
+ value = 0
36
+
37
+ below = 0
38
+ above = 0
39
+
40
+ while x > above
41
+
42
+ i = i + 1
43
+ below = above
44
+ above = Fibon.place(i)
45
+
46
+ end
47
+
48
+ if x-below > above - x
49
+ value = above
50
+ else
51
+ value = below
52
+ end
53
+ puts below
54
+ puts above
55
+
56
+ puts value
57
+
58
+ end
30
59
 
31
60
  end
@@ -1,3 +1,3 @@
1
1
  module Fibon
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  module Fibon
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fibon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-15 00:00:00.000000000 Z
12
+ date: 2013-11-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Fibonacci number Generator
15
15
  email: