* bug#19063: [FIX] Calc computing max of a vector of dates
@ 2014-11-15 17:58 Thierry Banel
[not found] ` <87389jhfxu.fsf@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Thierry Banel @ 2014-11-15 17:58 UTC (permalink / raw)
To: 19063
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@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))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-16 5:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-15 17:58 bug#19063: [FIX] Calc computing max of a vector of dates Thierry Banel
[not found] ` <87389jhfxu.fsf@gmail.com>
2014-11-16 5:36 ` bug#19063: Fwd: " Jay Belanger
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.