Mercurial > emacs
comparison lisp/calc/calc-forms.el @ 81541:ddeb68a08730
(math-format-date-part,math-parse-standard-date,calcFunc-julian):
Use `math-read-number-simple' to insert bignums.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Fri, 22 Jun 2007 04:09:00 +0000 |
parents | 1154f082efd9 |
children | 8fd0e7398c96 |
comparison
equal
deleted
inserted
replaced
81540:c14082c731e9 | 81541:ddeb68a08730 |
---|---|
556 ((eq x 'N) | 556 ((eq x 'N) |
557 (math-format-number math-fd-date)) | 557 (math-format-number math-fd-date)) |
558 ((eq x 'n) | 558 ((eq x 'n) |
559 (math-format-number (math-floor math-fd-date))) | 559 (math-format-number (math-floor math-fd-date))) |
560 ((eq x 'J) | 560 ((eq x 'J) |
561 (math-format-number (math-add math-fd-date '(float (bigpos 235 214 17) -1)))) | 561 (math-format-number |
562 (math-add math-fd-date | |
563 (math-read-number-simple "1.7214235")))) | |
562 ((eq x 'j) | 564 ((eq x 'j) |
563 (math-format-number (math-add (math-floor math-fd-date) '(bigpos 424 721 1)))) | 565 (math-format-number (math-add |
566 (math-floor math-fd-date) | |
567 (math-read-number-simple "1721424")))) | |
564 ((eq x 'U) | 568 ((eq x 'U) |
565 (math-format-number (nth 1 (math-date-parts math-fd-date 719164)))) | 569 (math-format-number (nth 1 (math-date-parts math-fd-date 719164)))) |
566 ((progn | 570 ((progn |
567 (or math-fd-dt | 571 (or math-fd-dt |
568 (progn | 572 (progn |
933 num (math-sub num | 937 num (math-sub num |
934 (if (memq this '(n N)) | 938 (if (memq this '(n N)) |
935 0 | 939 0 |
936 (if (or (eq this 'j) | 940 (if (or (eq this 'j) |
937 (math-integerp num)) | 941 (math-integerp num)) |
938 '(bigpos 424 721 1) | 942 (math-read-number-simple "1721424") |
939 '(float (bigpos 235 214 17) | 943 (math-read-number-simple "1.7214235")))) |
940 -1)))) | |
941 hour (or (nth 3 num) hour) | 944 hour (or (nth 3 num) hour) |
942 minute (or (nth 4 num) minute) | 945 minute (or (nth 4 num) minute) |
943 second (or (nth 5 num) second) | 946 second (or (nth 5 num) second) |
944 year (car num) | 947 year (car num) |
945 month (nth 1 num) | 948 month (nth 1 num) |
1144 (math-reject-arg date 'datep))))) | 1147 (math-reject-arg date 'datep))))) |
1145 | 1148 |
1146 (defun calcFunc-julian (date &optional zone) | 1149 (defun calcFunc-julian (date &optional zone) |
1147 (if (math-realp date) | 1150 (if (math-realp date) |
1148 (list 'date (if (math-integerp date) | 1151 (list 'date (if (math-integerp date) |
1149 (math-sub date '(bigpos 424 721 1)) | 1152 (math-sub date (math-read-number-simple "1721424")) |
1150 (setq date (math-sub date '(float (bigpos 235 214 17) -1))) | 1153 (setq date (math-sub date |
1154 (math-read-number-simple "1.7214235"))) | |
1151 (math-sub date (math-div (calcFunc-tzone zone date) | 1155 (math-sub date (math-div (calcFunc-tzone zone date) |
1152 '(float 864 2))))) | 1156 '(float 864 2))))) |
1153 (if (eq (car date) 'date) | 1157 (if (eq (car date) 'date) |
1154 (math-add (nth 1 date) (if (math-integerp (nth 1 date)) | 1158 (math-add (nth 1 date) (if (math-integerp (nth 1 date)) |
1155 '(bigpos 424 721 1) | 1159 (math-read-number-simple "1721424") |
1156 (math-add '(float (bigpos 235 214 17) -1) | 1160 (math-add (math-read-number-simple "1.7214235") |
1157 (math-div (calcFunc-tzone zone date) | 1161 (math-div (calcFunc-tzone zone date) |
1158 '(float 864 2))))) | 1162 '(float 864 2))))) |
1159 (math-reject-arg date 'datep)))) | 1163 (math-reject-arg date 'datep)))) |
1160 | 1164 |
1161 (defun calcFunc-unixtime (date &optional zone) | 1165 (defun calcFunc-unixtime (date &optional zone) |