* Scoring out of bounds
@ 2003-11-02 8:54 Norbert Koch
2003-11-02 12:17 ` Norbert Koch
0 siblings, 1 reply; 7+ messages in thread
From: Norbert Koch @ 2003-11-02 8:54 UTC (permalink / raw)
Hi!
I just stumbled over the following error
Signaling: (range-error "floor" 992188263.1)
floor(992188263.1)
gnus-decay-score(1044408698)
gnus-decay-scores(((touched nil) ("thread" ("<011120031152206042%mmanti@mac.com>" 1044408698 731520 s) ("<87r80s83r0.fsf@bird.agharta.de>" 1044408698 731520 s) .... (decay 731520)) 731520)
gnus-score-load-file("/usr/users/nk/.xemacs/gnus/.scores/comp.lang.lisp.ADAPT")
gnus-score-load-files(("/usr/users/nk/.xemacs/gnus/.scores/comp.lang.lisp.ADAPT" "/usr/users/nk/.xemacs/gnus/.scores/comp.lang.lisp.score" "/usr/users/nk/.xemacs/gnus/.scores/all.score"))
gnus-score-headers(("/usr/users/nk/.xemacs/gnus/.scores/comp.lang.lisp.ADAPT" "/usr/users/nk/.xemacs/gnus/.scores/comp.lang.lisp.score" "/usr/users/nk/.xemacs/gnus/.scores/all.score") nil)
gnus-possibly-score-headers()
gnus-summary-read-group-1("comp.lang.lisp" nil t nil nil nil)
gnus-summary-read-group("comp.lang.lisp" nil t nil nil nil nil)
gnus-group-read-group(nil t)
gnus-group-select-group(nil)
gnus-topic-select-group(nil)
call-interactively(gnus-topic-select-group)
Something's pushing scores up too high (my bad), but maybe it should
be bound in gnus-decay-score to prevent such errors?
norbert.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Scoring out of bounds
2003-11-02 8:54 Scoring out of bounds Norbert Koch
@ 2003-11-02 12:17 ` Norbert Koch
2003-11-04 4:04 ` Katsumi Yamaoka
0 siblings, 1 reply; 7+ messages in thread
From: Norbert Koch @ 2003-11-02 12:17 UTC (permalink / raw)
Norbert Koch <viteno@xemacs.org> writes:
> 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
Index: gnus-score.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-score.el,v
retrieving revision 6.35
diff -u -u -r6.35 gnus-score.el
--- 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)))
(defun gnus-decay-scores (alist day)
"Decay non-permanent scores in ALIST."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Scoring out of bounds
2003-11-02 12:17 ` Norbert Koch
@ 2003-11-04 4:04 ` Katsumi Yamaoka
2003-11-04 5:49 ` Norbert Koch
2003-11-19 6:48 ` Katsumi Yamaoka
0 siblings, 2 replies; 7+ messages in thread
From: Katsumi Yamaoka @ 2003-11-04 4:04 UTC (permalink / raw)
>>>>> 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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Scoring out of bounds
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
1 sibling, 1 reply; 7+ messages in thread
From: Norbert Koch @ 2003-11-04 5:49 UTC (permalink / raw)
Katsumi Yamaoka <yamaoka@jpl.org> writes:
> I've committed it with a slight modification[1]. Thanks.
Thanks for applying it.
> 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
Ah, I've always shifted in the other direction :-)
I'm not sure whether to call this behaviour a bug. If an operation
returns an out of bound value, you've always got two possibilities:
flag an error or silently convert it to the maximum allowed error.
norbert.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Scoring out of bounds
2003-11-04 5:49 ` Norbert Koch
@ 2003-11-04 6:18 ` Katsumi Yamaoka
0 siblings, 0 replies; 7+ messages in thread
From: Katsumi Yamaoka @ 2003-11-04 6:18 UTC (permalink / raw)
>>>>> In <vz65i0smwp.fsf@redqueen.bytechase.cx>
>>>>> Norbert Koch <viteno@xemacs.org> wrote:
> Katsumi Yamaoka <yamaoka@jpl.org> writes:
>> (floor (+ (lsh -1 -1) 0.999))
>> => 134217727
> Ah, I've always shifted in the other direction :-)
> I'm not sure whether to call this behaviour a bug. If an operation
> returns an out of bound value, you've always got two possibilities:
> flag an error or silently convert it to the maximum allowed error.
I don't intend to complain to the XEmacs development team
because it is not an essential problem when the score value
grows unusually large. ;-)
I was simply surprised that XEmacs' floor (and other arithmetic
functions) cannot handle a floating point number over the half
of the maximum integer:
(floor (+ (/ most-positive-fixnum 2.0) 0.499))
=> 536870911
(floor (+ (/ most-positive-fixnum 2.0) 0.500))
=> ...
--
Katsumi Yamaoka <yamaoka@jpl.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Scoring out of bounds
2003-11-04 4:04 ` Katsumi Yamaoka
2003-11-04 5:49 ` Norbert Koch
@ 2003-11-19 6:48 ` Katsumi Yamaoka
2003-11-20 7:30 ` Norbert Koch
1 sibling, 1 reply; 7+ messages in thread
From: Katsumi Yamaoka @ 2003-11-19 6:48 UTC (permalink / raw)
Cc: ding
>>>>> 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>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Scoring out of bounds
2003-11-19 6:48 ` Katsumi Yamaoka
@ 2003-11-20 7:30 ` Norbert Koch
0 siblings, 0 replies; 7+ messages in thread
From: Norbert Koch @ 2003-11-20 7:30 UTC (permalink / raw)
Katsumi Yamaoka <yamaoka@jpl.org> writes:
> I noticed that solution does not decay a score value eternally,
> and replaced it in CVS with the following definition:
Yes, a good thing to think of :)
Thanks,
norbert.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-11-20 7:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-02 8:54 Scoring out of bounds 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
2003-11-20 7:30 ` Norbert Koch
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).