Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

FINERACT-2809: Correct nop to invert pmt - #6409

Merged
adamsaghy merged 1 commit into
apache:developfrom
kadyrbekovhamit-cyber:fix/fineract-2809-nop-inverse
Sep 7, 2026
Merged

adamsaghy merged 1 commit into
apache:developfrom
kadyrbekovhamit-cyber:fix/fineract-2809-nop-inverse

Conversation

@kadyrbekovhamit-cyber

Copy link
Copy Markdown
Contributor

Description

For pmt(0.01, 12, 1000, 0, false), FinanicalFunctions.nop() currently returns 7 instead of 12. Replace its non-zero-rate expression with the algebraic inverse of pmt() and document rounding to the nearest whole payment, including the zero-rate branch.

https://issues.apache.org/jira/browse/FINERACT-2809

The inverse supports both payment timings and a non-zero future value. The three regression tests cover those cases and zero interest. A separate 33-case round-trip harness passes 33/33 with the correction, versus 8/33 on the original source.

Validation on develop e4474a0f4a4c65a75e7758e47db1fd277e5fcfef, JDK 25:

./gradlew :fineract-loan:test --tests '*FinanicalFunctionsTest' \
  :fineract-loan:spotlessCheck \
  :fineract-loan:checkstyleMain :fineract-loan:checkstyleTest

No production call site for nop() was found in the checked Java sources. This is a helper correctness fix; no production loan impact is claimed.

Research and proposed correction: Xamit Kadirbekov / GERO Research, following the discussion with Adam Saghy on the developer mailing list.

Checklist

  • Use the FINERACT issue key and the same title for the commit and PR.
  • Add regression tests and follow the coding conventions.
  • Keep the change focused and reviewable.
  • Acknowledge responsibility for addressing PR CI failures before requesting merge.
  • Review the upstream CI results when available.

There are no REST API changes. Full integration CI has not been run locally.

Solve the PMT equation for the number of payments and round to the nearest whole payment. Add regressions for zero/non-zero rates, both payment timings and non-zero future value.

Research and correction: Xamit Kadirbekov / GERO Research.
https://issues.apache.org/jira/browse/FINERACT-2809

@adamsaghy adamsaghy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adamsaghy
adamsaghy merged commit 6a15358 into apache:develop Sep 7, 2026
91 checks passed
@kadyrbekovhamit-cyber

Copy link
Copy Markdown
Contributor Author

Hello Adam and the Fineract team,

Thank you for reviewing and merging the inverse-helper correction. I would like to continue contributing useful calculation checks.

My broader Fineract case study is here: https://www.gero.uz/research/fineract-calculation-contracts/
It contains the pinned calculation conventions, reproducible grace-period and calendar examples, local candidate corrections and their limitations. The 25 common checks are test cases, not 25 independent bugs, and the additional 144 calendar cases were checked only on corrected code. This merged PR concerns the inverse helper alone. The separate helper report is https://www.gero.uz/research/articles/apache-fineract-nop-inverse-error.html

My background is applied mathematics and mechanics. I would welcome ongoing remote collaboration on day-count rules, repayment schedules, rounding and boundary cases, starting with one calculation family the team wants validated. I can supply independent expected results and focused regression tests through your normal JIRA/PR process.

Xamit Kadirbekov / GERO
kadyrbekovhamit@gmail.com

@adamsaghy

Copy link
Copy Markdown
Contributor

Hello Adam and the Fineract team,

Thank you for reviewing and merging the inverse-helper correction. I would like to continue contributing useful calculation checks.

My broader Fineract case study is here: https://www.gero.uz/research/fineract-calculation-contracts/ It contains the pinned calculation conventions, reproducible grace-period and calendar examples, local candidate corrections and their limitations. The 25 common checks are test cases, not 25 independent bugs, and the additional 144 calendar cases were checked only on corrected code. This merged PR concerns the inverse helper alone. The separate helper report is https://www.gero.uz/research/articles/apache-fineract-nop-inverse-error.html

My background is applied mathematics and mechanics. I would welcome ongoing remote collaboration on day-count rules, repayment schedules, rounding and boundary cases, starting with one calculation family the team wants validated. I can supply independent expected results and focused regression tests through your normal JIRA/PR process.

Xamit Kadirbekov / GERO kadyrbekovhamit@gmail.com

Thank you for sharing these. If you could raise stories to cover them one by one, that would be the best for everybody. We are looking forward to your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants