1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-27 07:37:33 +00:00
emacs/lisp/calc
Mattias Engdegård 0e00f199cd 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.
2020-09-14 11:19:22 +02:00
..
calc-aent.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-alg.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-arith.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-bin.el Use `format-prompt' when prompting with default values 2020-09-06 16:56:54 +02:00
calc-comb.el Calc: fix binomial coefficients for negative arguments (bug#16999) 2020-09-14 11:19:22 +02:00
calc-cplx.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-embed.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-ext.el Calc: fix autoload errors (bug#40800) 2020-04-24 20:19:37 +02:00
calc-fin.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-forms.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-frac.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-funcs.el Simplify big integer constants in Calc 2020-09-11 13:02:59 +02:00
calc-graph.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-help.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-incom.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-keypd.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-lang.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-macs.el Calc: don't treat nil as an integer (bug#40155) 2020-03-27 18:11:18 +01:00
calc-map.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-math.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-menu.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-misc.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-mode.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-mtx.el Calc: fix LU decomposition for non-numeric matrices (bug#41223) 2020-05-14 10:28:51 +02:00
calc-nlfit.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-poly.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-prog.el Calc: fix autoload errors (bug#40800) 2020-04-24 20:19:37 +02:00
calc-rewr.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-rules.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-sel.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-stat.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-store.el Use `format-prompt' when prompting with default values 2020-09-06 16:56:54 +02:00
calc-stuff.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-trail.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-undo.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-units.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-vec.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calc-yank.el Slight cleanup in calc-yank 2020-08-11 21:04:12 +02:00
calc.el Simplify big integer constants in Calc 2020-09-11 13:02:59 +02:00
calcalg2.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calcalg3.el ; Fix typos in format-prompt 2020-09-10 21:58:26 +03:00
calccomp.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00
calcsel2.el Update copyright year to 2020 2020-01-01 00:59:52 +00:00