aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/calendar/solar.el
diff options
context:
space:
mode:
authorPaul Eggert <[email protected]>1993-08-29 17:28:19 +0000
committerPaul Eggert <[email protected]>1993-08-29 17:28:19 +0000
commit3a2e3ab5ba7d7a8d9d1410fe60aa1bc159410b35 (patch)
tree06b29da8b12ee77ae9ee1885cede88e462afedd3 /lisp/calendar/solar.el
parent6bc457fea523673a7f898e9e14d3c652b3d66653 (diff)
Use integers instead of floating point where they will do.
(solar-equinoxes-solstices): Invert seasons in southern hemisphere. (solar-degrees-to-quadrant): Use `floor' instead of `truncate'.
Diffstat (limited to 'lisp/calendar/solar.el')
-rw-r--r--lisp/calendar/solar.el30
1 files changed, 18 insertions, 12 deletions
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el
index 61f3b6c426..ccfb4a3446 100644
--- a/lisp/calendar/solar.el
+++ b/lisp/calendar/solar.el
@@ -145,7 +145,7 @@ Returns nil if nothing was entered."
(defun solar-degrees-to-quadrant (angle)
"Determines the quadrant of ANGLE."
- (1+ (truncate (/ (mod angle 360.0) 90.0))))
+ (1+ (floor (mod angle 360) 90)))
(defun solar-arctan (x quad)
"Arctangent of X in quadrant QUAD."
@@ -188,7 +188,7 @@ Returns nil if nothing was entered."
(* 1.916 (solar-sin-degrees mean-anomaly))
(* 0.020 (solar-sin-degrees (* 2 mean-anomaly)))
282.634)
- 360.0)))
+ 360)))
(defun solar-right-ascension (longitude)
"Right ascension of the sun, given its LONGITUDE."
@@ -231,7 +231,7 @@ of hours. Returns nil if the sun does not rise at that location on that day."
(mod (- (+ local-sunrise solar-right-ascension-at-sunrise)
(+ (* 0.065710 approx-sunrise)
6.622))
- 24.0)))
+ 24)))
(+ (- local-mean-sunrise (solar-degrees-to-hours calendar-longitude))
(/ calendar-time-zone 60.0))))))
@@ -262,7 +262,7 @@ of hours. Returns nil if the sun does not set at that location on that day."
(local-mean-sunset
(mod (- (+ local-sunset solar-right-ascension-at-sunset)
(+ (* 0.065710 approx-sunset) 6.622))
- 24.0)))
+ 24)))
(+ (- local-mean-sunset (solar-degrees-to-hours calendar-longitude))
(/ calendar-time-zone 60.0))))))
@@ -372,7 +372,7 @@ several minutes."
app
(correction 1000))
(while (> correction 0.00001)
- (setq app (mod (solar-apparent-longitude-of-sun date) 360.0))
+ (setq app (mod (solar-apparent-longitude-of-sun date) 360))
(setq correction (* 58 (solar-sin-degrees (- (* k 90) app))))
(setq date (list (extract-calendar-month date)
(+ (extract-calendar-day date) correction)
@@ -489,18 +489,24 @@ Requires floating point."
(date (solar-equinoxes/solstices k y))
(day (extract-calendar-day date))
(time (* 24 (- day (truncate day))))
+ (s-hemi (and calendar-latitude (< calendar-latitude 0)))
;; Time zone/DST can't move the date out of range,
;; so let solar-time-string do the conversion.
(date (list (extract-calendar-month date)
(truncate day)
(extract-calendar-year date))))
- (list (list date
- (format "%s %s"
- (cond ((= k 0) "Vernal Equinox")
- ((= k 1) "Summer Solstice")
- ((= k 2) "Fall Equinox")
- ((= k 3) "Winter Solstice"))
- (solar-time-string time date)))))))
+ (list
+ (list date
+ (format "%s %s"
+ (cond ((= k 0)
+ (if s-hemi "Autumnal Equinox" "Vernal Equinox"))
+ ((= k 1)
+ (if s-hemi "Winter Solstice" "Summer Solstice"))
+ ((= k 2)
+ (if s-hemi "Vernal Equinox" "Autumnal Equinox"))
+ ((= k 3)
+ (if s-hemi "Summer Solstice" "Winter Solstice")))
+ (solar-time-string time date)))))))
(provide 'solar)