fast_xirr 1.0.0 → 1.0.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
  SHA256:
3
- metadata.gz: ffedd74eba94cee0cb84e526c4cfa95b130e4a825cf2c364b2d40ee76a4b2465
4
- data.tar.gz: 645c4fa612bee6386e150f94d761567897c705aab9f6903c4e269828721a2f5d
3
+ metadata.gz: f24d77d9ffd418ab7083fa4920995dc0976349a683265662abb481b6e264a2a2
4
+ data.tar.gz: 5d9a9feeacf8a6c436c68322763bf0a5177227cb3bab131cfe041e6853888df2
5
5
  SHA512:
6
- metadata.gz: 6f9d2c6941ad9147f16f3bc60b1b8c21e4387531d42601caa4ac9e8bf311d2a3103e5d894883829e61f439f2144e28be4486b580d01099fc9a73906817bacf53
7
- data.tar.gz: 6e75a9452dd542a4f766e1252929e43dce5502b173b7fb70a37e4ccbb0b4b89bb76e16f042ec1fe20c6f3c03d57050afa1be76649df468f07103365935872f36
6
+ metadata.gz: fa37a038365b015b4f879e9057ee7ac664c02475c56879e5cccaabef4f11a5847dc529e4963d127f2807d4ed074b0b62b2e83848a463bd9505dcd40044e2190d
7
+ data.tar.gz: 679fe4163ae248a8e03256e8a98da5b4abb6e1e88653703b9a218a74d03fe7b11681e4ec83386706ead27b8ec47ccaf8df29336bdf4367a32021314ef80c4f46
data/README.md CHANGED
@@ -107,12 +107,12 @@ To build the gem from the source code, follow these steps:
107
107
  gem build fast_xirr.gemspec
108
108
  ```
109
109
 
110
- This will create a `.gem` file in the directory, such as `fast_xirr-1.0.0.gem`.
110
+ This will create a `.gem` file in the directory, such as `fast_xirr-1.x.x.gem`.
111
111
 
112
112
  3. **Install the Gem Locally**:
113
113
 
114
114
  ```bash
115
- gem install ./fast_xirr-1.0.0.gem
115
+ gem install ./fast_xirr*.gem
116
116
  ```
117
117
 
118
118
  ### Testing the Gem
@@ -20,6 +20,11 @@
20
20
  double bisection_method(CashFlow *cashflows, long long count, double tol, long long max_iter, double low, double high) {
21
21
  double mid, f_low, f_mid, f_high;
22
22
 
23
+ //If cashflows are empty, return 0
24
+ if (count == 0) {
25
+ return 0.0;
26
+ }
27
+
23
28
  // Calculate the NPV at the boundaries of the interval
24
29
  f_low = npv(low, cashflows, count, cashflows[0].date);
25
30
  f_high = npv(high, cashflows, count, cashflows[0].date);
@@ -18,6 +18,11 @@
18
18
  * @return The estimated root (XIRR) or NAN if it fails to converge.
19
19
  */
20
20
  double brent_method(CashFlow *cashflows, long long count, double tol, long long max_iter, double low, double high) {
21
+ //If cashflows are empty, return 0
22
+ if (count == 0) {
23
+ return 0.0;
24
+ }
25
+
21
26
  // Calculate the NPV at the boundaries of the interval
22
27
  double fa = npv(low, cashflows, count, cashflows[0].date);
23
28
  double fb = npv(high, cashflows, count, cashflows[0].date);
@@ -1,4 +1,4 @@
1
1
  module FastXirr
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_xirr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Martini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-03 00:00:00.000000000 Z
11
+ date: 2024-07-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem to calculate the XIRR using a C extension for performance.
14
14
  email: