From: "Mattias Engdegård" <mattiase@acm.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Aaron Zeng <zeng.aaron.l@gmail.com>, 43677@debbugs.gnu.org
Subject: bug#43677: 27.1; Calc holidays off-by-one error, incorrect business day calculation
Date: Wed, 30 Sep 2020 11:42:58 +0200 [thread overview]
Message-ID: <0FA74B6A-DD93-41D7-91C4-ED4EB881E2DD@acm.org> (raw)
In-Reply-To: <CAFTimbVtuL9s7dOXZC=k43jkeEKnjvZ7kFOrFFBhdXb23z-ZrQ@mail.gmail.com>
> Indeed -- applying the following patch (which numbers Monday as 0 and Sunday as 6) makes the test case work correctly for me. But trying to follow the code makes it unclear... er... what's going on, and there aren't many comments in the Calc code to explain what they were thinking.
Welcome to Calc!
> I wondered whether this might be a US/non-US thing (with a difference in what day starts the week), but I couldn't really find anything in calc talking about that...
The weekday numbering can be arbitrary as long as it is only used internally. Calc's date representation (from Rata Die) sets Dec 31, 1 B.C. as day 0, and this happens to be a Sunday. That means that (mod DAY 7) is an easy way to get the week-starts-on-Sunday numbering used by some foreigners.
Since the bug is a regression -- it is present in Emacs 26.1 but not in 22.1.1 -- it may be a good idea to find out exactly what change introduced it, and work from there. That might reduce the risk of causing secondary bugs.
next prev parent reply other threads:[~2020-09-30 9:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 1:18 bug#43677: 27.1; Calc holidays off-by-one error, incorrect business day calculation Aaron Zeng
2020-09-30 2:50 ` Lars Ingebrigtsen
2020-09-30 8:55 ` Robert Pluim
2020-09-30 9:42 ` Mattias Engdegård [this message]
2020-09-30 13:40 ` Lars Ingebrigtsen
2020-09-30 15:52 ` Glenn Morris
2020-09-30 16:22 ` Lars Ingebrigtsen
2020-09-30 16:31 ` Andreas Schwab
2020-09-30 16:12 ` Mattias Engdegård
2020-09-30 16:23 ` Lars Ingebrigtsen
2020-10-01 10:19 ` Mattias Engdegård
2020-10-01 22:47 ` Aaron Zeng
2020-10-02 10:00 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0FA74B6A-DD93-41D7-91C4-ED4EB881E2DD@acm.org \
--to=mattiase@acm.org \
--cc=43677@debbugs.gnu.org \
--cc=larsi@gnus.org \
--cc=zeng.aaron.l@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).