Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
Cc: ding@gnus.org
Subject: Re: Scoring out of bounds
Date: Wed, 19 Nov 2003 15:48:30 +0900	[thread overview]
Message-ID: <b9y4qx07t1d.fsf@jpl.org> (raw)
In-Reply-To: <b9yekwohj9a.fsf@jpl.org>

>>>>> In <b9yekwohj9a.fsf@jpl.org> Katsumi Yamaoka wrote:

>>>>>> In <vz3cd7c6bu.fsf@redqueen.bytechase.cx>
>>>>>>	Norbert Koch <viteno@xemacs.org> wrote:

>>> Something's pushing scores up too high (my bad), but maybe it should
>>> be bound in gnus-decay-score to prevent such errors?

>> Here's a possible fix

>>  (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 most-positive-fixnum)))

> I've committed it with a slight modification[1].  Thanks.

I noticed that solution does not decay a score value eternally,
and replaced it in CVS with the following definition:

(defun gnus-decay-score (score)
  "Decay SCORE according to `gnus-score-decay-constant' and `gnus-score-decay-scale'."
  (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))))
-- 
Katsumi Yamaoka <yamaoka@jpl.org>



  parent reply	other threads:[~2003-11-19  6:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-02  8:54 Norbert Koch
2003-11-02 12:17 ` Norbert Koch
2003-11-04  4:04   ` Katsumi Yamaoka
2003-11-04  5:49     ` Norbert Koch
2003-11-04  6:18       ` Katsumi Yamaoka
2003-11-19  6:48     ` Katsumi Yamaoka [this message]
2003-11-20  7:30       ` Norbert Koch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9y4qx07t1d.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).