From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ting Boon Ghee Newsgroups: gmane.emacs.bugs Subject: bug#74760: 29.4; Calc : calcFunc-rate does not produce negative results Date: Wed, 11 Dec 2024 02:40:34 +0800 Message-ID: References: <87ldwobycr.fsf@BULLSEYE-debian-live-builder> <87v7vrsb5u.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000332b1b0628eed3af" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25278"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74760@debbugs.gnu.org To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 10 19:43:24 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tL5Cc-0006Oa-WD for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 10 Dec 2024 19:43:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tL5CK-0001Wz-Jn; Tue, 10 Dec 2024 13:43:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tL5CJ-0001WB-3K for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2024 13:43:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL5CI-00063P-OG for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2024 13:43:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=n0/+tFtyNlZBDQLCXh4X8iKMmIFk43zd6LbB//yoixI=; b=vpMvnCdpKFg2HoN0RchmbIvKVoUUAcVLrvjUqSsM5aPH60NUVXIJ1TfI49JYyGpv7tFkvbUOGRKL1scHyyCHJD+5x5gOU/UFPqmJ3SOeWLWHi9BEgqbqN2ZFOcIBdV6CzApC7Tqky1WVVZMHM3WfbHurCT/ojERGzO7PtIw/biQea6jcamuuuFS8ldtwcTWujCL/wRFwNZiBodeTGoaETUxL1uiomB40Io5rG2lEFip5rIBEXalRjZhloqfj0CVbl5ZziIVGf6zyKH2xbJsP9i47GDZVKwT7Uyqf32I0tWScqdbS48d477evPtBD3jzZFn+sUvbRnxQnoG+/wKxt6A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tL5CI-0005v3-GZ for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2024 13:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ting Boon Ghee Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Dec 2024 18:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74760 X-GNU-PR-Package: emacs Original-Received: via spool by 74760-submit@debbugs.gnu.org id=B74760.173385613422495 (code B ref 74760); Tue, 10 Dec 2024 18:43:02 +0000 Original-Received: (at 74760) by debbugs.gnu.org; 10 Dec 2024 18:42:14 +0000 Original-Received: from localhost ([127.0.0.1]:59559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL5BW-0005qk-8d for submit@debbugs.gnu.org; Tue, 10 Dec 2024 13:42:14 -0500 Original-Received: from mail-pj1-f54.google.com ([209.85.216.54]:42434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL5BT-0005qb-T3 for 74760@debbugs.gnu.org; Tue, 10 Dec 2024 13:42:12 -0500 Original-Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2ee76929a98so4632049a91.1 for <74760@debbugs.gnu.org>; Tue, 10 Dec 2024 10:42:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733856071; x=1734460871; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=n0/+tFtyNlZBDQLCXh4X8iKMmIFk43zd6LbB//yoixI=; b=RXVCBKpPrfoiZCe7NVSVkxGZbgCW0H2cwx51GjR/L3XyjgrmS2gS4ocD0EwRKykDr8 ChWL5/Ndv318S3g3e1Whh200LVxVQUa8b/zHkvMzOJyFva4YPrfoSeYmpSzrH586Z/q7 XIAPtYAiBANzki17CyYbk6H+tcAf/uAj01F1cKFXdhmgkMiRbuVKiz87td+ayA6G1SoJ kuAUl0lf1kiKan5y4TmMDzdahLPeNPQeZ8qpy7r8GGYe8Y/ovlZIGSORIdfs5Oi0Mcxr weSSGie/5/CPJ/R6RS+zEaQ6Keug6nK4R4zNWQ0p7O+AL9MVz5lh+xQE4IK+3wVhdHY8 LIIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733856071; x=1734460871; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n0/+tFtyNlZBDQLCXh4X8iKMmIFk43zd6LbB//yoixI=; b=cG15XVmsmD3EEZyvdYr4MbyGuADeukrfqWYdHFcdMNZaAwhIvbCf5ATZQ2CgprnYs2 iDe3jQHuJZSkW5J3Gm8zhil+Asz52utnbAxulVB1bV5+rl4MEtwuSUBbsRkn5y9cFiPH 0uF5DPbsTeZdO06Z6db4ZjvSUYw791hXRexp7YHbNDJp5P2oGPSLj88EwA9Br/fHabee JIYkYAK3FYlJJMIVptP3cLbbA7/Ro7vEMTt+cUemP20BX94Z7knwCgen3RZnRM1mkm0+ tyNgW7JSS1hT7UKXqu8vhfyhewOuQV6nRwkGLAyII+5aO8BJz0U4oF72/7DlLwOSBGNM jNUA== X-Gm-Message-State: AOJu0Yx33/OfhAkBa823nn5uIBY2lxicWmzLjmSdjoaphO1M642+TJsE OmbiHsPNO9U2A9uf/4/ZldufkHmB+pQg3ZvIbFtLGm+Xy3M4gaifTBipi3lttuUbliwy7gZcUf8 5JHDnafSNU/oSNN83EjIWMHnziX4= X-Gm-Gg: ASbGncucvMd33Zlh4w8FvZA5sM+ajAFKnCWtSYzTMSe0tkwYaPnQRhavOYEOaHO+qj5 JhdvdsuUIZSaa2QAXlXmYCuX3e+PgGZh1Eg== X-Google-Smtp-Source: AGHT+IHM3xCupKSNpsU97eGejor+gvRYoA+7759CAU4V5wGGy66fGoe93VftV4m4tnbS8J8KpFtOPP8eluBYLugZXMI= X-Received: by 2002:a17:90b:1c8a:b0:2ee:9229:e4bd with SMTP id 98e67ed59e1d1-2efd597df71mr6628577a91.2.1733856070933; Tue, 10 Dec 2024 10:41:10 -0800 (PST) In-Reply-To: <87v7vrsb5u.fsf@web.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296776 Archived-At: --000000000000332b1b0628eed3af Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 =E2=80=98pv=E2= =80=99: =E2=80=98rate(N, PAYMENT, AMOUNT)=E2=80=99 computes the value of RATE such = that =E2=80=98pv(RATE, N, PAYMENT) =3D AMOUNT=E2=80=99. So let's try PV. If Rate =3D -0.1, N =3D 1, PAYMENT =3D 90, calculate PV. Thus, M-x calc _0.1 1 90 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. --=20 Best regards, Boon Ghee --000000000000332b1b0628eed3af Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks everyone for response.

These financial functions (and more) are available in spreadsheets such a= s Libreoffice Calc. There is no restriction for Rate to be negative in Libr= eoffice Calc. One way to look at this is, from investment perspective, it j= ust 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 =E2=80=98pv=E2=80=99: =E2=80=98rate(N,=C2= =A0PAYMENT, AMOUNT)=E2=80=99 computes the value of RATE such that =E2=80=98= pv(RATE, N,=C2=A0PAYMENT) =3D AMOUNT=E2=80=99. So let's try PV.

If Rate =3D -0.1, N =3D 1, PAYMENT =3D 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=C2=A0returns. The negative returns generated errors= in the table fields.

I suppose Emacs Calc w= as developed long ago to mimic handheld calculators. I'd wonder whether= anyone is still using it as a "handheld" financial calculator. S= uch functions are most useful in spreadsheets. Emacs now has an implementat= ion of a spreadsheet in the form of Org Table that uses Emacs Calc. This do= es mean that it is restricted to what Emacs Calc can provide. A missing fun= ction that I wish for is the XIRR function available in other spreadsheet s= oftwares.

--
Best regards= ,
Boon Ghee
--000000000000332b1b0628eed3af--