bug in gamma(negative float)



Since several versions of maxima, I find


L:nason>maxima
GCL (GNU Common Lisp)  Version(2.4.0) Wed May  9 12:02:00 CDT 2001
Licensed under GNU Library General Public License
Contains Enhancements by W. Schelter
Maxima 5.6 Wed May 9 12:01:49 CDT 2001 (with enhancements by W. Schelter).
Licensed under the GNU Public License (see file COPYING)
(C1) gamma(-0.2);


Error: Caught fatal error [memory may be damaged]
Fast links are on: do (si::use-fast-links nil) for debugging
Error signalled by CATCH.
Broken at MACSYMA-TOP-LEVEL.  Type :H for Help.
MAXIMA>>


I usually fixed this by loading the following:


(in-package "MAXIMA")
;; the following, taken unaltered from csimp2.lisp, for some
;; unknown reason fixes bug in gamma(negative float).
(defun do-gammafloat (a)
  (do ((r 1.0 (*$ z r))
       (s (minusp a)) (z (abs a)))
      ((not (greaterp z 1.0))
       (setq r (*$ r (gamma z)))
       (cond (s (t//$ -3.141592654 (*$ a r ($sin (*$ 3.141592654 a))) 'gamma))
	     (t r)))
    (setq z (1-$ z))))

Best regards, P. Nason

-- 
Paolo Nason, INFN, sez. di Milano
Universita' di Milano-Bicocca,
Dip. di Fisica "G. Occhialini",
Piazza della Scienza, 3
20126 Milano
Phone: +39-02-64482541.
Fax:   +39-02-64482582.
Home Phone: +39-039-9284685.