From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Banel Newsgroups: gmane.emacs.bugs Subject: bug#19063: [FIX] Calc computing max of a vector of dates Date: Sat, 15 Nov 2014 18:58:55 +0100 Message-ID: <5467945F.2060609@free.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1416074851 20422 80.91.229.3 (15 Nov 2014 18:07:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 18:07:31 +0000 (UTC) To: 19063@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 15 19:07:24 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xphkp-0000XF-Qw for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 19:07:24 +0100 Original-Received: from localhost ([::1]:41478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xphkp-0000mj-Bv for geb-bug-gnu-emacs@m.gmane.org; Sat, 15 Nov 2014 13:07:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xphkd-0000lu-VW for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 13:07:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XphkU-00012W-VJ for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 13:07:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36863) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XphkU-00012Q-T5 for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 13:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XphkU-0003gM-EZ for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 13:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Banel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 15 Nov 2014 18:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19063 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.141607478514103 (code B ref -1); Sat, 15 Nov 2014 18:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Nov 2014 18:06:25 +0000 Original-Received: from localhost ([127.0.0.1]:34076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xphjs-0003fP-Q7 for submit@debbugs.gnu.org; Sat, 15 Nov 2014 13:06:25 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54904) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xphd5-0003T1-6T for submit@debbugs.gnu.org; Sat, 15 Nov 2014 12:59:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xphcv-0006tv-QN for submit@debbugs.gnu.org; Sat, 15 Nov 2014 12:59:22 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36632) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xphcv-0006tr-NW for submit@debbugs.gnu.org; Sat, 15 Nov 2014 12:59:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xphcp-0006sp-Cx for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 12:59:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xphcj-0006t2-6t for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 12:59:07 -0500 Original-Received: from smtp1-g21.free.fr ([212.27.42.1]:26436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xphcj-0006sx-16 for bug-gnu-emacs@gnu.org; Sat, 15 Nov 2014 12:59:01 -0500 Original-Received: from [IPv6:2a01:e35:2e21:def0:5d53:abbc:1d97:8db8] (unknown [IPv6:2a01:e35:2e21:def0:5d53:abbc:1d97:8db8]) by smtp1-g21.free.fr (Postfix) with ESMTP id 72C5194008D for ; Sat, 15 Nov 2014 18:56:39 +0100 (CET) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sat, 15 Nov 2014 13:06:23 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:96073 Hi the list. * Description In Calc there is a bug when computing the max or min of a vector of dates. The fix is quite simple (change a car to a caar) * Unit testing M-x calc launch Calc t N insert "now" date-time 7+ add 7 days (or whatever) t N insert "now" again Esc 2 v p pack both date-times in a vector u X call calc-vector-max ==> result with the bug: vmax([<7:36:14pm Thu Nov 20, 2014>, <7:36:54pm Thu Nov 13, 2014>]) ==> result with the fix: <7:36:14pm Thu Nov 20, 2014> This test also works with "min" instead of "max" and u N instead of u X * ChangeLog 2014-11-13 Thierry Banel * calc-arith.el (math-max-list, math-min-list): fix bug for date handling. * Patch *** calc-arith.el-old 2014-11-13 19:58:13.159676097 +0100 --- calc-arith.el-new 2014-11-13 20:00:01.886392943 +0100 *************** *** 2249,2255 **** (defun math-min-list (a b) (if b ! (if (or (Math-anglep (car b)) (eq (car b) 'date) (and (eq (car (car b)) 'intv) (math-intv-constp (car b))) (math-infinitep (car b))) (math-min-list (math-min a (car b)) (cdr b)) --- 2249,2255 ---- (defun math-min-list (a b) (if b ! (if (or (Math-anglep (car b)) (eq (caar b) 'date) (and (eq (car (car b)) 'intv) (math-intv-constp (car b))) (math-infinitep (car b))) (math-min-list (math-min a (car b)) (cdr b)) *************** *** 2279,2285 **** (defun math-max-list (a b) (if b ! (if (or (Math-anglep (car b)) (eq (car b) 'date) (and (eq (car (car b)) 'intv) (math-intv-constp (car b))) (math-infinitep (car b))) (math-max-list (math-max a (car b)) (cdr b)) --- 2279,2285 ---- (defun math-max-list (a b) (if b ! (if (or (Math-anglep (car b)) (eq (caar b) 'date) (and (eq (car (car b)) 'intv) (math-intv-constp (car b))) (math-infinitep (car b))) (math-max-list (math-max a (car b)) (cdr b))