summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/find-func.el
diff options
context:
space:
mode:
authorMattias Engdegård <mattiase@acm.org>2020-09-11 11:43:15 +0200
committerMattias Engdegård <mattiase@acm.org>2020-09-14 11:19:22 +0200
commit0e00f199cd3599977f75326bb7adc9d70390661e (patch)
tree8d3faf34a7beaff4f09f465e8d9a357a6943068a /lisp/emacs-lisp/find-func.el
parentf66829e0f47a54a51fd1378acbf2b1085673790f (diff)
downloademacs-0e00f199cd3599977f75326bb7adc9d70390661e.tar.gz
emacs-0e00f199cd3599977f75326bb7adc9d70390661e.tar.bz2
emacs-0e00f199cd3599977f75326bb7adc9d70390661e.zip
Calc: fix binomial coefficients for negative arguments (bug#16999)
For some values outside integers 0≤k≤n, (n choose k) gave wrong results, entered infinite recursion or used unreasonably amounts of stack space. This change fixes that and extends the function to all integer arguments using the definitions from M. J. Kronenburg (https://arxiv.org/abs/1105.3689). * lisp/calc/calc-comb.el (calcFunc-choose): Fix sign error to prevent infinite recursion and extend function to handle all integer arguments. (math-choose-iter, math-choose-float-iter): Rewrite in iterative form; no TCO in elisp yet. * test/lisp/calc/calc-tests.el (calc-tests--fac, calc-tests--choose) (calc-tests--check-choose, calc-tests--explain-choose) (calc-tests--calc-to-number): New helper functions. (calc-choose): New test.
Diffstat (limited to 'lisp/emacs-lisp/find-func.el')
0 files changed, 0 insertions, 0 deletions