[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sqrt/complex bug

Of course, you realize that this reflects the underlying arithmetic
(ergo, can hardly be called a KCL bug).  I observe the following
behavior in a Sun3:
      >(sqrt -1)
      #C(-4.371139S-8 1.0S0)

      >(sqrt -1.0)
      #C(6.123031769111886E-17 1.0)

      >(sqrt #C(-1.0 0.0))
      #C(6.123031769111886E-17 1.0)

Ten-to-the-minus-17 is as close to zero in the real part as I would
expect from this machine, especially because the advertised value of
long-float-epsilon is 1.110223024625157E-16.

Enter Daydreaming-mode:  a truly decent symbolic system would,
upon seeing its sign, convert the integer argument -1 into the
(gaussian-)integer #C(-1 0) and try the square root there, giving the
(gaussian-)integer #C(0 1).  And, if impossible in QxQ, would only then
coerce to floats and try in C.  That would be great for Computer
Algebra, but *always* looking for the correct algebraic closure will
make sqrt too expensive an operation for numerical purposes, so we
better not mess with it.

Cesar Augusto  Quiroz Gonzalez

Department of Computer Science     ...allegra!rochester!quiroz
University of Rochester            or
Rochester,  NY 14627               quiroz@cs.rochester.edu