From: Jean Louis <bugs@gnu.support>
To: help-gnu-emacs@gnu.org
Subject: Rounding percentages... was setq-default
Date: Tue, 20 Apr 2021 08:44:28 +0300 [thread overview]
Message-ID: <YH5qPFMzROB9ySJm@protected.localdomain> (raw)
In-Reply-To: <87czuqi3t0.fsf@zoho.eu>
* Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2021-04-19 20:28]> > Let us say there are 2 buffers, you wish to mark 3 people
> > in the list in one buffer and 4 people in the list in other
> > buffer, but you don't want to mix them. Their marks go into
> > individual or buffer local variables that are named same
> > but are different from buffer to buffer. [...]
>
> This is what you do for a living, move people
> between buffers?
I also may move goods from buffer to buffer.
> But I also have lists of people, .mailrc is one, the other is
> a NOC list (Non-Official Cover list) of people climbing in
> our tree house [1] - without here being tricked into letting
> the authorities score an easy win by me disclosing the list,
> let me say that it is a possibility that we currently have 57
> people climbing, 52% from se, 16 nationalities, 54% females.
(defun pct-of-number-in-total (number total)
"Return the percentage that NUMBER represents in a TOTAL."
(/ number total 0.01))
(defun pct-of-number-in-total-1 (number total)
"Return the percentage that NUMBER represents in a TOTAL."
(let* ((number (+ number 0.0))
(total (+ total 0.0))
(percent (/ total 100.0))
(percentage (/ number percent 100)))
percentage))
(defun pct-list (list)
"Return list that representes percentages of values in a given LIST."
(let* ((total (apply '+ list)))
(mapcar (lambda (item) (pct-of-number-in-total item total)) list)))
(pct-list '(31 26)) ⇒ (54.385964912280706 45.614035087719294)
I am not sure how do you get 54% females, maybe one of them is round?
(pct-list '(30 27)) ⇒ (52.63157894736842 47.368421052631575)
The round one must be coming from Sweden according to above math.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/
next prev parent reply other threads:[~2021-04-20 5:44 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-18 11:40 don't understand setq-default Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-18 13:02 ` Omar Polo
2021-04-18 13:39 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-18 13:40 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-18 14:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-18 14:59 ` Omar Polo
2021-04-19 3:06 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-19 3:23 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-19 3:33 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-19 6:40 ` Omar Polo
2021-04-19 13:39 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-19 12:49 ` Thibaut Verron
2021-04-19 17:29 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-18 21:59 ` Jean Louis
2021-04-18 22:28 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-19 6:44 ` Jean Louis
2021-04-19 17:17 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-19 3:49 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-19 6:52 ` Jean Louis
2021-04-19 17:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-20 5:44 ` Jean Louis [this message]
2021-04-30 1:04 ` Rounding percentages... was setq-default Emanuel Berg via Users list for the GNU Emacs text editor
2021-04-18 21:55 ` don't understand setq-default Jean Louis
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=YH5qPFMzROB9ySJm@protected.localdomain \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.