emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110944: * calc/calc-forms.el (math-l


From: Jay Belanger
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110944: * calc/calc-forms.el (math-leap-year-p): Fix formula for negative
Date: Sun, 18 Nov 2012 23:03:08 -0600
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110944
committer: Jay Belanger <address@hidden>
branch nick: trunk
timestamp: Sun 2012-11-18 23:03:08 -0600
message:
  * calc/calc-forms.el (math-leap-year-p):  Fix formula for negative
  year numbers.
  (math-date-to-julian-dt): Adjust the initial approximation for the
  year to deal with the new definition of the DATE.
modified:
  lisp/ChangeLog
  lisp/calc/calc-forms.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-11-19 01:39:37 +0000
+++ b/lisp/ChangeLog    2012-11-19 05:03:08 +0000
@@ -1,3 +1,10 @@
+2012-11-19  Jay Belanger  <address@hidden>
+
+       * calc/calc-forms.el (math-leap-year-p):  Fix formula for negative
+       year numbers.
+       (math-date-to-julian-dt): Adjust the initial approximation for the
+       year to deal with the new definition of the DATE.
+
 2012-11-19  Daniel Colascione  <address@hidden>
 
        * term/w32-win.el (cygwin-convert-path-from-windows): Accomodate

=== modified file 'lisp/calc/calc-forms.el'
--- a/lisp/calc/calc-forms.el   2012-11-18 03:59:00 +0000
+++ b/lisp/calc/calc-forms.el   2012-11-19 05:03:08 +0000
@@ -371,9 +371,10 @@
 ;;; These versions are rewritten to use arbitrary-size integers.
 
 ;;; A numerical date is the number of days since midnight on
-;;; the morning of December 31, 1 B.C.  Emacs's calendar refers to such
-;;; a date as an absolute date, some function names also use that 
-;;; terminology.  If the date is a non-integer, it represents a specific date 
and time.
+;;; the morning of December 31, 1 B.C. (Gregorian) or January 2, 1 A.D. 
(Julian).
+;;; Emacs's calendar refers to such a date as an absolute date, some Calc 
function
+;;; names also use that terminology.  If the date is a non-integer, it 
represents 
+;;; a specific date and time. 
 ;;; A "dt" is a list of the form, (year month day), corresponding to
 ;;; an integer code, or (year month day hour minute second), corresponding
 ;;; to a non-integer code.
@@ -408,8 +409,8 @@
   (let* ((month 1)
          day
          (year (math-quotient (math-add date (if (Math-lessp date 711859)
-                                                 365  ; for speed, we take
-                                               -108)) ; >1950 as a special case
+                                                 367  ; for speed, we take
+                                               -106)) ; >1950 as a special case
                               (if (math-negp date) 366 365)))
                                        ; this result may be an overestimate
          temp)
@@ -494,6 +495,8 @@
       (if (math-negp year)
          (= (math-imod (math-neg year) 4) 1)
        (= (math-imod year 4) 0))
+    (if (math-negp year)
+        (setq year (math-sub -1 year)))
     (setq year (math-imod year 400))
     (or (and (= (% year 4) 0) (/= (% year 100) 0))
        (= year 0))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]