The bug is almost surely in the function sign-mexpt--here is a portion of this
code. On the first line sign-base is $nz, so sign-base is set to $zero. After that
the global sign is set to sign-base. The final conditional doesn't have a clause for
$zero, so sign remains zero. A quick cure would be append a clause ((eq sign-base '$zero) ..., I suppose.
I don't think it should raise the "argument cannot be imaginary" error, because -x^2-x^4 is not strictly negative. For x = 0, it's zero. This is a major limitation of sign. It has no way to say "zero or complex". Basically all possible answers it can return are wrong or misleading.
I think the answer zero of sign should be interpreted as "zero, if not complex".
So maybe this is an issue of how sign's return value should be interpreted.
Last edit: David Scherfgen 2026-05-29
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Same bug, I suppose
$ ./maxima-local
Maxima 5.28.0_232_g5b9ec8e http://maxima.sourceforge.net
using Lisp Clozure Common Lisp Version 1.8-r15286M (WindowsX8664)
(%i1) assume(p <=0)$
(%i2) csign(sqrt(p));
(%o2) zero
The bug is almost surely in the function sign-mexpt--here is a portion of this
code. On the first line sign-base is $nz, so sign-base is set to $zero. After that
the global sign is set to sign-base. The final conditional doesn't have a clause for
$zero, so sign remains zero. A quick cure would be append a clause ((eq sign-base '$zero) ..., I suppose.
I don't think it should raise the "argument cannot be imaginary" error, because
-x^2-x^4is not strictly negative. Forx = 0, it's zero. This is a major limitation ofsign. It has no way to say "zero or complex". Basically all possible answers it can return are wrong or misleading.I think the answer
zeroofsignshould be interpreted as "zero, if not complex".So maybe this is an issue of how
sign's return value should be interpreted.Last edit: David Scherfgen 2026-05-29