Adam Saghy created FINERACT-2809:
------------------------------------

             Summary: FinanicalFunctions.nop() helper: non-zero-rate branch is 
not the algebraic inverse of the adjacent pmt() function
                 Key: FINERACT-2809
                 URL: https://issues.apache.org/jira/browse/FINERACT-2809
             Project: Apache Fineract
          Issue Type: Improvement
    Affects Versions: 1.15.0
            Reporter: Adam Saghy
            Assignee: Adam Saghy
             Fix For: 1.16.0


>From Xamit Kadirbekov (GERO Research):

I found a reproducible mathematical defect in the public 
FinanicalFunctions.nop() helper. Its non-zero-rate branch is not the algebraic 
inverse of the adjacent pmt() function.

Minimal round trip:
rate = 0.01
periods = 12
principal = 1000
future value = 0
type = false
pmt(...) = -88.848788678342
current nop(...) = 7
expected nop(...) = 12

A repository-wide search found no current call site for nop(), so I am treating 
this as a dormant library defect rather than claiming production loan impact.

I prepared a focused correction and regression tests in a public fork:
[https://github.com/kadyrbekovhamit-cyber/fineract/commit/6980e1377ce2e5a1eaf0586e628b27bb64dd8c26]

The proposed inverse is:
A = emiAmount * (type ? 1 + rate : 1)
growth = (A - rate * futureValue) / (A + rate * principal)
N = log(growth) / log1p(rate)

The corrected implementation passes 33/33 direct PMT/NOP round trips across 
zero and non-zero rates, both payment timings, and a non-zero future value. A 
JUnit test is included. The full Gradle target could not run locally because 
this checkout requires JDK 25 while the available JDK is 26.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to