Gnus development mailing list
 help / color / mirror / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
Subject: Re: Scoring out of bounds
Date: Tue, 04 Nov 2003 13:04:17 +0900	[thread overview]
Message-ID: <b9yekwohj9a.fsf@jpl.org> (raw)
In-Reply-To: <vz3cd7c6bu.fsf@redqueen.bytechase.cx>

>>>>> 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

> --- gnus-score.el	13 Aug 2003 16:34:46 -0000	6.35
> +++ gnus-score.el	2 Nov 2003 12:14:46 -0000
> @@ -2918,13 +2918,15 @@

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

I've committed it with a slight modification[1].  Thanks.
BTW, isn't it an XEmacs bug?  Emacs's floor can handle the value
of an argument that it returns the maximum integer:

(floor (+ (lsh -1 -1) 0.999))
 => 134217727

[1] The most-positive-fixnum variable is not always available in
21.3 or older versions of Emacs since it is defined in cl.el.
-- 
Katsumi Yamaoka <yamaoka@jpl.org>



  reply	other threads:[~2003-11-04  4:04 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 [this message]
2003-11-04  5:49     ` Norbert Koch
2003-11-04  6:18       ` Katsumi Yamaoka
2003-11-19  6:48     ` Katsumi Yamaoka
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=b9yekwohj9a.fsf@jpl.org \
    --to=yamaoka@jpl.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).