GNU bug report logs - #19063
[FIX] Calc computing max of a vector of dates

Previous Next

Package: emacs;

Reported by: Thierry Banel <tbanelwebmin <at> free.fr>

Date: Sat, 15 Nov 2014 18:07:02 UTC

Severity: normal

Done: Jay Belanger <jay.p.belanger <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19063 in the body.
You can then email your comments to 19063 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#19063; Package emacs. (Sat, 15 Nov 2014 18:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thierry Banel <tbanelwebmin <at> free.fr>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 15 Nov 2014 18:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thierry Banel <tbanelwebmin <at> free.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: [FIX] Calc computing max of a vector of dates
Date: Sat, 15 Nov 2014 18:58:55 +0100
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 <tbanelwebmin <at> free.fr>

    * 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))





Reply sent to Jay Belanger <jay.p.belanger <at> gmail.com>:
You have taken responsibility. (Sun, 16 Nov 2014 05:37:01 GMT) Full text and rfc822 format available.

Notification sent to Thierry Banel <tbanelwebmin <at> free.fr>:
bug acknowledged by developer. (Sun, 16 Nov 2014 05:37:02 GMT) Full text and rfc822 format available.

Message #10 received at 19063-done <at> debbugs.gnu.org (full text, mbox):

From: Jay Belanger <jay.p.belanger <at> gmail.com>
To: 19063-done <at> debbugs.gnu.org
Subject: Fwd: Re: bug#19063: [FIX] Calc computing max of a vector of dates
Date: Sat, 15 Nov 2014 23:36:10 -0600
[Message part 1 (text/plain, inline)]
---------- Forwarded message ----------
From: "Jay Belanger" <jay.p.belanger <at> gmail.com>
Date: Nov 15, 2014 11:28 PM
Subject: Re: bug#19063: [FIX] Calc computing max of a vector of dates
To: <done-19063 <at> debbugs.gnu.org>
Cc: <jay.p.belanger <at> gmail.com>


Thanks; I've committed your fix.

Jay
[Message part 2 (text/html, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 14 Dec 2014 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 187 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.