Michael Somos on Tue, 14 Nov 2000 19:47:43 -0500


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

[GP/PARI] 2.0.21 hangup


I have encountered a situation which seems like a bug to me.

excalibur:/home1/faculty/somos> /tmp/local/bin/gp-2.0 
Reading GPRC: /home1/faculty/somos/.gprc ...Done.

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

                           Copyright (C) 1989-2000 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> f(x,d=10,v=0)=
{
  local(rc);
/*DEB*/ if(v,print("f("x","d")"));
  rc=
  if(x<=0, error("only positive allowed in f()"),
  if(d<0, error("recur depth positive"),
  if(x==1|d==0, 0,
  if(x<1, -f(1/x,d-1,v),
  /*x>1*/ exp(f(x-1,d-1,v))
  ))));
/*DEB*/ if(v,print("f("x","d")="rc));
  rc;
} /* end f() */
gp> f(16/5,8,1)
f(16/5,8)
f(11/5,7)
f(6/5,6)
f(1/5,5)
f(5,4)
f(4,3)
f(3,2)
f(2,1)
f(1,0)
f(1,0)=0
f(2,1)=1.000000000000000000000000000
f(3,2)=2.718281828459045235360287471
f(4,3)=15.15426224147926418976043027
f(5,4)=3814279.104760220592209219594
f(1/5,5)=-3814279.104760220592209219594
f(6/5,6)=4.289076188000423375581902986 E-1656521
f(11/5,7)=1.000000000000000000000000000

At this point the system seems to hang for a long long time. I
am not sure where the bug lies, but it may be in exp(). Shalom, Michael

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