emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

math/stats `new-rating-system'


From: Emanuel Berg
Subject: math/stats `new-rating-system'
Date: Sun, 14 Jul 2024 20:15:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Here is a function to transform a score in one system to the
corresponding in some other system.

Maybe something for a math or stats package in ELPA, if we
have one?

I don't know if I got the docstring just right. It looks more
relaxed in the help system compared to in the source,
for sure.

(defun new-rating-system (r rw rb w b &optional float)
  "R is the rating.
For example in a 1-5 system a good rating is 4.\n
RW and RB are the endpoints of the current system.
In a 1-5 system they are 1 and 5.\n
W and B are the endpoints of the desired system.
If a 1-30 system is desired they are 1 and 30.\n
FLOAT is set for a float return instead of the
default integer type.\n
Example:\n
If your rating is 4 out of 5 in the 1-5 system,
how much is that in a 1-30 system? Eval this:\n
  (new-rating-system 4 1 5 1 30)\n
Answer: 4 out of 5 corresponds to 22 out of 30."
  (let ((rating (+ w (* (- r rw) (/ (- b w) (- rb rw) 1.0)))))
    (if float
        (format "%.1f" rating)
      (floor rating) )))

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]