|
From: Raymond T. <toy...@gm...> - 2025-12-04 16:28:33
|
On 12/4/25 5:43 AM, Barton Willis via Maxima-discuss wrote: > OK, maybe I found the culprit: > > (defun bfloat-erf (z) > ;; Warning! This has round-off problems when abs(z) is very small. > (let ((1//2 ($bfloat '((rat simp) 1 2)))) > ;; The argument is real, the result is real too > ($realpart > (mul > (simplify (list '(%signum) z)) > (sub 1 > (mul > (div 1 (power ($bfloat '$%pi) 1//2)) > (bfloat-gamma-incomplete 1//2 ($bfloat (power z 2))))))))) > > > > And similarly for |complex-bfloat-erf| . Changing 1//2 to bfhalf in > this code didn't result in any testsuite failures, but I have a few > pending changes to the function |absarg.| Nice bit of detective work! Yeah, renaming 1//2 to something else should take care of the problem. > > |Also, loading gamma.lisp gives the warning: (SBCL)| > > in: DEFUN GAMMA-INCOMPLETE > ; (COND ((COMPLEXP MAXIMA::X) #C(0.0d0 0.0d0)) ((REALP MAXIMA::X) > 0.0d0)) I think there are lots of these. The issue here is that the compiler doesn't know what X is, so the |cond| cases of |complexp| and |realp| covers the case of numbers, but there are lots of other types which aren't covered. This can be fixed in two ways. Add |(declare (number x))|. Add a |T| clause to |cond|. This should probably signal an error. Or maybe even replace the |cond| with |etypecase|? ​ |