unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* math/stats `new-rating-system'
@ 2024-07-14 18:15 Emanuel Berg
  0 siblings, 0 replies; only message in thread
From: Emanuel Berg @ 2024-07-14 18:15 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-14 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-14 18:15 math/stats `new-rating-system' Emanuel Berg

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).