From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#26165: date-week-day screws up prior to AD 1 Date: Sat, 18 Mar 2017 23:45:28 +0000 Message-ID: <20170318234528.GL6518@fysh.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1489880770 16823 195.159.176.226 (18 Mar 2017 23:46:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Mar 2017 23:46:10 +0000 (UTC) To: 26165@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Mar 19 00:46:04 2017 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpO2t-0003my-N3 for guile-bugs@m.gmane.org; Sun, 19 Mar 2017 00:46:03 +0100 Original-Received: from localhost ([::1]:54984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpO2z-0004wa-Kx for guile-bugs@m.gmane.org; Sat, 18 Mar 2017 19:46:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpO2u-0004wT-49 for bug-guile@gnu.org; Sat, 18 Mar 2017 19:46:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpO2t-0007cL-A7 for bug-guile@gnu.org; Sat, 18 Mar 2017 19:46:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36210) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cpO2s-0007cH-ON for bug-guile@gnu.org; Sat, 18 Mar 2017 19:46:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cpO2s-0005aB-Hq for bug-guile@gnu.org; Sat, 18 Mar 2017 19:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 18 Mar 2017 23:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 26165 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148988074321423 (code B ref -1); Sat, 18 Mar 2017 23:46:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Mar 2017 23:45:43 +0000 Original-Received: from localhost ([127.0.0.1]:34409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpO2Z-0005ZT-6T for submit@debbugs.gnu.org; Sat, 18 Mar 2017 19:45:43 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60923) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpO2X-0005ZG-4R for submit@debbugs.gnu.org; Sat, 18 Mar 2017 19:45:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpO2R-0007Wj-7C for submit@debbugs.gnu.org; Sat, 18 Mar 2017 19:45:35 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:58318) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cpO2R-0007Wb-4J for submit@debbugs.gnu.org; Sat, 18 Mar 2017 19:45:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cpO2Q-0004wA-1S for bug-guile@gnu.org; Sat, 18 Mar 2017 19:45:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cpO2P-0007Vy-C3 for bug-guile@gnu.org; Sat, 18 Mar 2017 19:45:34 -0400 Original-Received: from river6.fysh.org ([2001:41d0:d:20da::2]:58278 helo=river.fysh.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cpO2P-0007VS-33 for bug-guile@gnu.org; Sat, 18 Mar 2017 19:45:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fysh.org; s=20170316; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date; bh=3o/Y5wBhaCXkdrtUwFHZSb37IZEiVXnq3ruHkYA51f4=; b=Akhfir+hhtudSxvMl0lVgXfIOT8h/t4TVAMTleuXr1/zZPImf/HdQaoOGlzQaqPoO8vEH37rVmeCds8ldf/J3XnOGtrslemirUb4ZD6q9BHp0ikimavJeFYUzyUtUtu6hHwcp2KmphnSleRHWAszYz8TgYkMrT2s4C9dCtCh23k=; Original-Received: from zefram by river.fysh.org with local (Exim 4.84_2 #1 (Debian)) id 1cpO2K-00079B-J0; Sat, 18 Mar 2017 23:45:28 +0000 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8707 Archived-At: Looking at day of the week, via SRFI-19's date-week-day: scheme@(guile-user)> (use-modules (srfi srfi-19)) scheme@(guile-user)> (julian-day->date 1721426 0) $1 = # scheme@(guile-user)> (date-week-day (julian-day->date 1721426 0)) $2 = 1 scheme@(guile-user)> (date-week-day (julian-day->date 1721425 0)) $3 = 6 The output for 0001-01-01, Monday, is correct. The preceding day is actually a Sunday, but Saturday was shown. Looking at the code, this bug arises for the same reason as the problem with date-year-day raised in bug#26151. The date-year value, of the weird zero-skipping year numbering, is passed to an algorithm that obviously expects astronomical year numbering. Looking at the code also reveals a second problem: the algorithm is written to perform divisions with quotient where it obviously needs modulo. This will manifest in erroneous computations for some earlier years once the above is fixed. -zefram