From ef2baefafb5093bf5a8c65d8e93a6eb704364e2b Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Wed, 19 Nov 2003 06:48:30 +0000 Subject: [PATCH] (gnus-decay-score): Return a surely smaller value than the argument in XEmacs. --- lisp/ChangeLog | 5 +++++ lisp/gnus-score.el | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index de7a766ed..2f5e19406 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2003-11-19 Katsumi Yamaoka + + * gnus-score.el (gnus-decay-score): Return a surely smaller value + than the argument in XEmacs. + 2003-11-18 Reiner Steib * message.el (message-insert-to): Don't use `gnus-message'. diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el index a33bce540..bb2e342d4 100644 --- a/lisp/gnus-score.el +++ b/lisp/gnus-score.el @@ -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." -- 2.34.1