(gnus-decay-score): Return a surely smaller value than the argument in XEmacs.
authorKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 19 Nov 2003 06:48:30 +0000 (06:48 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 19 Nov 2003 06:48:30 +0000 (06:48 +0000)
lisp/ChangeLog
lisp/gnus-score.el

index de7a766..2f5e194 100644 (file)
@@ -1,3 +1,8 @@
+2003-11-19  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-score.el (gnus-decay-score): Return a surely smaller value
+       than the argument in XEmacs.
+
 2003-11-18  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * message.el (message-insert-to): Don't use `gnus-message'.
index a33bce5..bb2e342 100644 (file)
@@ -2918,15 +2918,19 @@ If ADAPT, return the home adaptive file instead."
 
 (defun gnus-decay-score (score)
   "Decay SCORE according to `gnus-score-decay-constant' and `gnus-score-decay-scale'."
-  (condition-case nil
-      (floor
-       (- score
-         (* (if (< score 0) -1 1)
-            (min (abs score)
-                 (max gnus-score-decay-constant
-                      (* (abs score)
-                         gnus-score-decay-scale))))))
-    (arith-error (lsh -1 -1))))
+  (let ((n (- score
+             (* (if (< score 0) -1 1)
+                (min (abs score)
+                     (max gnus-score-decay-constant
+                          (* (abs score)
+                             gnus-score-decay-scale)))))))
+    (if (and (featurep 'xemacs)
+            ;; XEmacs' floor can handle only the floating point
+            ;; number below the half of the maximum integer.
+            (> (abs n) (lsh -1 -2)))
+       (string-to-number
+        (car (split-string (number-to-string n) "\\.")))
+      (floor n))))
 
 (defun gnus-decay-scores (alist day)
   "Decay non-permanent scores in ALIST."