Subject: Re: bug#74760: 29.4; Calc : calcFunc-rate does not produce negative results

From: Ting Boon Ghee <[email-masked]>
Date: Wed, 11 Dec 2024 02:40:34 +0800

Thanks everyone for response.

These financial functions (and more) are available in spreadsheets such as
Libreoffice Calc. There is no restriction for Rate to be negative in
Libreoffice Calc. One way to look at this is, from investment perspective,
it just means the series of payments is less than the initial outlay,
resulting in negative return.

The Info manual describes the Rate function as an inverse of ‘pv’:
‘rate(N, PAYMENT, AMOUNT)’ computes the value of RATE such that ‘pv(RATE,
N, PAYMENT) = AMOUNT’. So let's try PV.

If Rate = -0.1, N = 1, PAYMENT = 90, calculate PV. Thus,

M-x calc <RET> _0.1 <RET> 1 <RET> 90 <RET> b P
Answer : 100

This means PV function can accept Rate as a negative number.

I stumbled upon this issue because I was trying to recreate a table that I
had done previously in Libreoffice Calc into an Org Table. The table uses
Rate function to calculate a series of returns with a range of negative to
positive returns. The negative returns generated errors in the table fields.

I suppose Emacs Calc was developed long ago to mimic handheld calculators.
I'd wonder whether anyone is still using it as a "handheld" financial
calculator. Such functions are most useful in spreadsheets. Emacs now has
an implementation of a spreadsheet in the form of Org Table that uses Emacs
Calc. This does mean that it is restricted to what Emacs Calc can provide.
A missing function that I wish for is the XIRR function available in other
spreadsheet softwares.

-- 
Best regards,
Boon Ghee