From: Takafumi Hayashi
Subject: cmcul problem
Date: 
Message-ID: <TAKAFUMI.95Jul5084347@csesun01.u-aizu.ac.jp>
Hi:

There seems to be a bug in the complex number routines in cmucl. 



=======
CMU Common Lisp 17f, running on pross41
Send bug reports and questions to your local CMU CL maintainer, or to
··········@cs.cmu.edu.
Loaded subsystems:
    Python 1.0, target SPARCstation/Sun 4
    CLOS based on PCL version:  September 16 92 PCL (f)
    CLX X Library MIT R5.02
    Motif toolkit and graphical debugger 1.0
    Hemlock 3.5
* (setq j (sqrt -1))
Warning:  Declaring J special.
#C(-4.3711388e-8 1.0)

* (+ 1 j)
#C(0.99999994 1.0)

* (- 1 j)
#C(1.0 1.0)

* (quit)
=======


Thanks in advance

--
Takafumi Hayashi             ········@u-aizu.ac.jp
The University of Aizu       phone : +81-242-37-2614
                             fax   : +81-242-37-2747
From: Takafumi Hayashi
Subject: Re: cmcul problem
Date: 
Message-ID: <TAKAFUMI.95Jul5140117@csesun01.u-aizu.ac.jp>
In article <·····················@csesun01.u-aizu.ac.jp> ········@u-aizu.ac.jp (Takafumi Hayashi) writes:

Hi:
 > 
 > There seems to be a bug in the complex number routines in cmucl. 
 > 
 > 
 > 
 > =======
 > CMU Common Lisp 17f, running on pross41
 > Send bug reports and questions to your local CMU CL maintainer, or to
 > ··········@cs.cmu.edu.
 > Loaded subsystems:
 >     Python 1.0, target SPARCstation/Sun 4
 >     CLOS based on PCL version:  September 16 92 PCL (f)
 >     CLX X Library MIT R5.02
 >     Motif toolkit and graphical debugger 1.0
 >     Hemlock 3.5
 > * (setq j (sqrt -1))
 > Warning:  Declaring J special.
 > #C(-4.3711388e-8 1.0)
 > 
 > * (+ 1 j)
 > #C(0.99999994 1.0)
 > 
 > * (- 1 j)
 > #C(1.0 1.0)



In  code/numbers.lisp,
(defmacro two-arg-+/- (name op big-op)
  `(defun ,name (x y)
     (number-dispatch ((x number) (y number))
   ...
       (((foreach bignum fixnum ratio single-float double-float) complex)
        (complex (,op x (realpart y)) (imagpart y)))
   ...

last line MIGHT be 

        (complex (,op x (realpart y)) (,op (imagpart y))))


--
Takafumi Hayashi             ········@u-aizu.ac.jp
The University of Aizu       phone : +81-242-37-2614
                             fax   : +81-242-37-2747

--
Takafumi Hayashi             ········@u-aizu.ac.jp
The University of Aizu       phone : +81-242-37-2614
                             fax   : +81-242-37-2747