This bug was discovered by Claude Opus 5.5 and reproduced on Maxima Git commit c62924c (2026-09-26) with SBCL 2.2.9.
Where: src/hypergeometric.lisp, CLASSIFY-HYPERGEOMETRIC
The undefinedness test needs the greatest nonpositive integer in b, which gives the first zero denominator, but the loop keeps the least one (-5 instead of -1). The call is then classified as a polynomial and evaluating it divides by zero instead of returning a noun form, as hypergeometric([-3],[-1],x) already does.
src/hypergeometric.lisp as described under "Fix".tests/rtest_hg.mac, at the end of the file.make check, or run_testsuite(share_tests=true); in ./maxima-local), and check that the change breaks no test. Failures that also occur without the change (a run on the unchanged build shows which) are pre-existing and can be ignored.* \#5382 hypergeometric([-3],[-1,-5],2) signals a Lisp division-by-zero error to ChangeLog, under "Bug fixes for numbered bugs:".Fixed by commit [1a2b3c]., with the first six characters of the commit's SHA in the brackets (git rev-parse HEAD | cut -c1-6 prints them). SourceForge links this to the commit.hypergeometric([-3],[-1,-5],2);
Before the fix:
Maxima encountered a Lisp error: arithmetic error DIVISION-BY-ZERO signalled (with 2.0 instead of 2: pquotient: attempted quotient by zero.)
Correct result:
hypergeometric([-3],[-5,-1],2)
In src/hypergeometric.lisp (CLASSIFY-HYPERGEOMETRIC, "(or (eq bh nil) (< bk bh))"), replace
;; Let bh = the least member of b that is a negative integer. If there is
;; no such member, set bh = nil.
(dolist (bk b)
(if (and (integerp bk) (<= bk 0) (or (eq bh nil) (< bk bh))) (setq bh bk)))
with
;; Let bh = the greatest member of b that is a negative integer. If there is
;; no such member, set bh = nil.
(dolist (bk b)
(if (and (integerp bk) (<= bk 0) (or (eq bh nil) (> bk bh))) (setq bh bk)))
In src/hypergeometric.lisp (CLASSIFY-HYPERGEOMETRIC, ";; non-nil and ah >= bh"), replace
;; non-nil and ah >= bh, and each member of a and b are numbers. (We don't
with
;; non-nil and bh >= ah, and each member of a and b are numbers. (We don't
Add these lines to tests/rtest_hg.mac, separated from the tests before them by two empty lines:
/* Bug #5382: "hypergeometric([-3],[-1,-5],2) signals a Lisp division-by-zero error" */
args(hypergeometric([-3],[-1,-5],2));
[[-3],[-5,-1],2]$
args(hypergeometric([-3],[-1,-5],2.0));
[[-3],[-5,-1],2.0]$
hypergeometric.lisp: fix hypergeometric([-3],[-1,-5],2)
The undefinedness test in CLASSIFY-HYPERGEOMETRIC needs the greatest
nonpositive integer in b, which gives the first zero denominator, but
the loop kept the least one. hypergeometric([-3],[-1,-5],2) was then
taken for a polynomial and dividing by zero gave a Lisp error. It now
stays unevaluated, as hypergeometric([-3],[-1],x) does.
This fixes bug #5382.
Found and fixed by Claude Opus 5.5.
Diff:
Fixed by Commit [7d3fce] . Closing this ticket.
Related
Commit: [7d3fce]