exonio 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 869b6fadbc67f60c0e2f8b0e895729937d81fc4f
4
- data.tar.gz: 130a055e7462d062ef80c08bb4047b290cbd9e1e
3
+ metadata.gz: a78b47da7f327af032c2c2eb15b19873b3633216
4
+ data.tar.gz: c307fa7b9e8e3b8072e14fa2ad9f56fdf660eab8
5
5
  SHA512:
6
- metadata.gz: 0e5a2f45443ff975165c2101ea57fc5397d8a3e3ee7c1cc93ede9119ab2d050d865a16a439e5c306ba26c3b898220a90a6385ed97176f8378c5dbaea1ba9782e
7
- data.tar.gz: c0065bced80d07a240ca0c2a57a0a958207e300093dd09bbdea781dae432794e89d1705a116fb5a996326e1f47f755dbb39d03c237ae18800b65d009b89eca5f
6
+ metadata.gz: 6cb43b81c45f8fd358a3ec755bfb92c9f76d90de0cc81c8bbe50db6eed48df939ae2e45d48b7e660295bf1445e15c08216a790d610cc7ff81284287695186b3b
7
+ data.tar.gz: 5d63764dfe31e91ad66ad82b30567a1c68d41450c536cefc0a3ee0361eed55fef9b5a146b05e4d583f512f817f2b0f88766bc1770ff6ba0e503ed662a7bbb25d
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # CHANGELOG
2
+
3
+ ## 0.1.1
4
+
5
+ * Remove round from `pmt` and `fv` methods
6
+
7
+ ## 0.1.0
8
+
9
+ * Implements fv, nper and pmt methods
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- exonio (0.1.0)
4
+ exonio (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
24
24
  To use Exonio you just have to call the method you like to use. Example:
25
25
 
26
26
  ```ruby
27
- Exonio.pmt(0.075 / 12, 12 * 15, 200_000) # ==> -1854.02
27
+ Exonio.pmt(0.075 / 12, 12 * 15, 200_000) # ==> -1854.0247200054619
28
28
  ```
29
29
 
30
30
  ## Available Formulas
@@ -36,7 +36,7 @@ an additional monthly savings of $100 with the interest rate at
36
36
  5% (annually) compounded monthly?
37
37
 
38
38
  ```ruby
39
- Exonio.fv(0.05 / 12, 10 * 12, -100, -100) # ==> 15692.93
39
+ Exonio.fv(0.05 / 12, 10 * 12, -100, -100) # ==> 15692.928894335748
40
40
  ```
41
41
 
42
42
  By convention, the negative sign represents cash flow out (i.e. money not
@@ -60,7 +60,7 @@ What is the monthly payment needed to pay off a $200,000 loan in 15
60
60
  years at an annual interest rate of 7.5%?
61
61
 
62
62
  ```ruby
63
- Exonio.nper(0.075 / 12, 12 * 15, 200_000) # ==> -1854.02
63
+ Exonio.pmt(0.075 / 12, 12 * 15, 200_000) # ==> -1854.0247200054619
64
64
  ```
65
65
 
66
66
  In order to pay-off (i.e., have a future-value of 0) the $200,000 obtained
@@ -13,14 +13,13 @@ module Exonio
13
13
  # @return [Float]
14
14
  #
15
15
  # @example
16
- # Exonio.fv(0.05 / 12, 12 * 10, -100, -100) # ==> 15692.93
16
+ # Exonio.fv(0.05 / 12, 12 * 10, -100, -100) # ==> 15692.928894335748
17
17
  #
18
18
  def fv(rate, nper, pmt, pv, end_or_beginning = 0)
19
19
  temp = (1 + rate) ** nper
20
20
  fact = (1 + rate* end_or_beginning) * (temp - 1) / rate
21
- result = -(pv * temp + pmt * fact)
22
21
 
23
- result.round(2)
22
+ -(pv * temp + pmt * fact)
24
23
  end
25
24
 
26
25
 
@@ -59,14 +58,13 @@ module Exonio
59
58
  # @return [Float]
60
59
  #
61
60
  # @example
62
- # Exonio.pmt(0.075/12, 12*15, 200_000) # ==> -1854.02
61
+ # Exonio.pmt(0.075/12, 12*15, 200_000) # ==> -1854.0247200054619
63
62
  #
64
63
  def pmt(rate, nper, pv, fv = 0, end_or_beginning = 0)
65
64
  temp = (1 + rate) ** nper
66
65
  fact = (1 + rate * end_or_beginning) * (temp - 1) / rate
67
- result = -(fv + pv * temp) / fact
68
66
 
69
- result.round(2)
67
+ -(fv + pv * temp) / fact
70
68
  end
71
69
  end
72
70
  end
@@ -1,3 +1,3 @@
1
1
  module Exonio
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exonio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael Izidoro
@@ -63,6 +63,7 @@ files:
63
63
  - ".gitignore"
64
64
  - ".rspec"
65
65
  - ".travis.yml"
66
+ - CHANGELOG.md
66
67
  - Gemfile
67
68
  - Gemfile.lock
68
69
  - LICENSE.md