help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: math (was: Re: not good proposal: "C-z <letter>" reserved for users)


From: Jean Louis
Subject: Re: math (was: Re: not good proposal: "C-z <letter>" reserved for users)
Date: Sat, 13 Feb 2021 18:29:15 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

* Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> [2021-02-13 18:21]:
> Jean Louis wrote:
> 
> > Thanks, I knew somebody will improve it for free.
> >
> > Now I will use:
> >
> > (defun pct-of-number-in-total (number total)
> >   "Return the percentage that NUMBER represents in a TOTAL."
> >   (/ number total 0.01))
> 
> But that's even better, one less function AND no 1.0 or
> `float'.
> 
> (defun percent (n d)
>   (let ((pct (/ n d 0.01)))
>     (message "%.1f%%" pct)))
> ;; (percent 8  256) ; 3.1%
> ;; (percent 0 1337) ; 0.0%

Does 1337 comes from your early years?



reply via email to

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