Michael Somos on Fri, 29 Oct 1999 16:09:18 -0400 (EDT)

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

cotan() bug

                    GP/PARI CALCULATOR Version 2.0.17 (beta)
                i686 running linux (ix86 kernel) 32-bit version
              (readline v2.2 enabled, extended help not available)

                           Copyright (C) 1989-1999 by
          C. Batut, K. Belabas, D. Bernardi, H. Cohen and M. Olivier.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

   realprecision = 28 significant digits
   seriesprecision = 16 significant terms
   format = g0.28

parisize = 4000000, primelimit = 500000
gp> /* define our own co,sin,cot functions */
gp> c(x)=(exp(x*I)+exp(-x*I))/2
gp> s(x)=(exp(x*I)-exp(-x*I))/2/I
gp> cot(x)=c(x)/s(x)
gp> /* test it out on real and complex numbers */
gp> cot(1)
%1 = 0.6420926159343307030064199865 + 0.E-29*I
gp> cotan(1)
%2 = 0.6420926159343307030064199865
gp> cot(I)
%3 = 0.E-28 - 1.313035285499331303636161246*I
gp> cotan(I)
  ***   division by zero in gdiv, gdivgs or ginv

This seems like a bug to me. Shalom, Michael

Michael Somos <somos@grail.cba.csuohio.edu>     Cleveland State University
http://grail.cba.csuohio.edu/~somos/            Cleveland, Ohio, USA 44115