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 +4 -4
- data/README.md +2 -2
- data/ext/fast_xirr/bisection.c +5 -0
- data/ext/fast_xirr/brent.c +5 -0
- data/lib/fast_xirr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f24d77d9ffd418ab7083fa4920995dc0976349a683265662abb481b6e264a2a2
|
4
|
+
data.tar.gz: 5d9a9feeacf8a6c436c68322763bf0a5177227cb3bab131cfe041e6853888df2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
115
|
+
gem install ./fast_xirr*.gem
|
116
116
|
```
|
117
117
|
|
118
118
|
### Testing the Gem
|
data/ext/fast_xirr/bisection.c
CHANGED
@@ -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);
|
data/ext/fast_xirr/brent.c
CHANGED
@@ -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);
|
data/lib/fast_xirr/version.rb
CHANGED
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.
|
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-
|
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:
|