diff options
| author | Glenn Morris | 2011-04-19 19:09:06 -0700 |
|---|---|---|
| committer | Glenn Morris | 2011-04-19 19:09:06 -0700 |
| commit | f195c582d8e568fac9a161c6c4fc96de87a30ea7 (patch) | |
| tree | 7bdd3a4967c0fb0de8500272747a30688081ffbf | |
| parent | 6b1f6ce90ed255e05fb843cde2f738a88b9fef14 (diff) | |
| download | emacs-f195c582d8e568fac9a161c6c4fc96de87a30ea7.tar.gz emacs-f195c582d8e568fac9a161c6c4fc96de87a30ea7.zip | |
solar.el fixes.
* lisp/calendar/solar.el (solar-horizontal-coordinates):
Use the longitude argument rather than `calendar-longitude' (15yr old bug).
(solar-date-next-longitude): Remove unused locals.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/calendar/solar.el | 28 |
2 files changed, 18 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 66f854da5e3..867d7f9aa23 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-04-20 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * calendar/solar.el (solar-horizontal-coordinates): | ||
| 4 | Use the longitude argument rather than `calendar-longitude'. | ||
| 5 | (solar-date-next-longitude): Remove unused locals. | ||
| 6 | |||
| 1 | 2011-04-19 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2011-04-19 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * progmodes/octave-mod.el (octave-in-comment-p, octave-in-string-p) | 9 | * progmodes/octave-mod.el (octave-in-comment-p, octave-in-string-p) |
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el index 31aed0484d7..84a1544d709 100644 --- a/lisp/calendar/solar.el +++ b/lisp/calendar/solar.el | |||
| @@ -453,7 +453,7 @@ height (between -180 and 180) are both in degrees." | |||
| 453 | (st (+ solar-sidereal-time-greenwich-midnight | 453 | (st (+ solar-sidereal-time-greenwich-midnight |
| 454 | (* ut 1.00273790935))) | 454 | (* ut 1.00273790935))) |
| 455 | ;; Hour angle (in degrees). | 455 | ;; Hour angle (in degrees). |
| 456 | (ah (- (* st 15) (* 15 (car ec)) (* -1 (calendar-longitude)))) | 456 | (ah (- (* st 15) (* 15 (car ec)) (* -1 longitude))) |
| 457 | (de (cadr ec)) | 457 | (de (cadr ec)) |
| 458 | (azimuth (solar-atn2 (- (* (solar-cosine-degrees ah) | 458 | (azimuth (solar-atn2 (- (* (solar-cosine-degrees ah) |
| 459 | (solar-sin-degrees latitude)) | 459 | (solar-sin-degrees latitude)) |
| @@ -771,26 +771,22 @@ day numbers. The values of `calendar-daylight-savings-starts', | |||
| 771 | `calendar-daylight-savings-starts-time', `calendar-daylight-savings-ends', | 771 | `calendar-daylight-savings-starts-time', `calendar-daylight-savings-ends', |
| 772 | `calendar-daylight-savings-ends-time', `calendar-daylight-time-offset', | 772 | `calendar-daylight-savings-ends-time', `calendar-daylight-time-offset', |
| 773 | and `calendar-time-zone' are used to interpret local time." | 773 | and `calendar-time-zone' are used to interpret local time." |
| 774 | (let* ((long) | 774 | (let ((start d) |
| 775 | (start d) | 775 | (next (mod (* l (1+ (floor (/ (solar-longitude d) l)))) 360)) |
| 776 | (start-long (solar-longitude d)) | 776 | (end (+ d (* (/ l 360.0) 400))) |
| 777 | (next (mod (* l (1+ (floor (/ start-long l)))) 360)) | 777 | long) |
| 778 | (end (+ d (* (/ l 360.0) 400))) | 778 | ;; Bisection search for nearest minute. |
| 779 | (end-long (solar-longitude end))) | 779 | (while (< 0.00001 (- end start)) |
| 780 | (while ; bisection search for nearest minute | 780 | ;; start <= d < end |
| 781 | (< 0.00001 (- end start)) | ||
| 782 | ;; start <= d < end | ||
| 783 | ;; start-long <= next < end-long when next != 0 | 781 | ;; start-long <= next < end-long when next != 0 |
| 784 | ;; when next = 0, we look for the discontinuity (start-long is near 360 | 782 | ;; when next = 0, look for the discontinuity (start-long is near 360 |
| 785 | ;; and end-long is small (less than l). | 783 | ;; and end-long is small (less than l)). |
| 786 | (setq d (/ (+ start end) 2.0) | 784 | (setq d (/ (+ start end) 2.0) |
| 787 | long (solar-longitude d)) | 785 | long (solar-longitude d)) |
| 788 | (if (or (and (not (zerop next)) (< long next)) | 786 | (if (or (and (not (zerop next)) (< long next)) |
| 789 | (and (zerop next) (< l long))) | 787 | (and (zerop next) (< l long))) |
| 790 | (setq start d | 788 | (setq start d) |
| 791 | start-long long) | 789 | (setq end d))) |
| 792 | (setq end d | ||
| 793 | end-long long))) | ||
| 794 | (/ (+ start end) 2.0))) | 790 | (/ (+ start end) 2.0))) |
| 795 | 791 | ||
| 796 | ;; FIXME but there already is solar-sunrise-sunset. | 792 | ;; FIXME but there already is solar-sunrise-sunset. |