Hmm. not true, IMO. Proof:There is no "special" handling for negative numbers. Because all these elementary calculations work just fine with any real number (positive or negative).
This gives a wrong result ec when sc is negative:
sc=-200; pp=10.668192; n=4; ec = sc * pow(1 + pp / 100, n) ; ec
-300.00000032494801157600
But when used with a positive sc it suddenly gives a correct result:
sc=100; pp=10.668192; n=4; ec = sc * pow(1 + pp / 100, n) ; ec
150.00000016247400578800
sc is startcap, ec is endcap. The pp (ie. periodpercent) is from your previous example; it gives 50% after 4 periods (ie. n=4 above) [ie. after subtracting the initial 100%].
As you can see: using a negative value does not work (gives wrong result), and sometimes even impossible to calculate b/c logarithm of a negative value is mathematically undefined (that variant of the above formula is used when solving it for n).
Btw, the above code is from the "bc" calculator under Linux.
Last edited:
)