Synch to Gnus 200311040404.
authoryamaoka <yamaoka>
Tue, 4 Nov 2003 04:07:24 +0000 (04:07 +0000)
committeryamaoka <yamaoka>
Tue, 4 Nov 2003 04:07:24 +0000 (04:07 +0000)
lisp/ChangeLog
lisp/gnus-score.el

index 66a0623..9f91ea3 100644 (file)
@@ -1,3 +1,8 @@
+2003-11-04  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-score.el (gnus-decay-score): Protect against arithmetic
+       errors.  Tiny patch from Norbert Koch <viteno@xemacs.org>.
+
 2003-10-31  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * spam.el
index ce255e8..bf5de64 100644 (file)
@@ -2953,13 +2953,15 @@ 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'."
-  (floor
-   (- score
-      (* (if (< score 0) -1 1)
-        (min (abs score)
-             (max gnus-score-decay-constant
-                  (* (abs score)
-                     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))))
 
 (defun gnus-decay-scores (alist day)
   "Decay non-permanent scores in ALIST."