Opened 7 years ago

Closed 7 years ago

#14082 closed defect (fixed)

PARI stack overflow crashes Sage

Reported by: jdemeyer Owned by: jdemeyer
Priority: critical Milestone: sage-5.8
Component: c_lib Keywords:
Cc: Merged in: sage-5.8.beta3
Authors: Jeroen Demeyer Reviewers: David Roe
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #13618 Stopgaps:

Description (last modified by jdemeyer)

The following crashes Sage hard:

sage: i = CDF.0
sage: fz=animate([line([zeta(s+i*t) for t in srange(0,50,0.01)]) for s in srange(0,0.9,0.01)],xmin=-1.5,ymin=-2,xmax=2.5,ymax=2)
  ***   the PARI stack overflows !
  current stack size: 16000000 (15.259 Mbytes)
  [hint] you can increase GP stack with allocatemem()

  ***   Error in the PARI system. End of program.

The problem is simple: instead of using the proper PARI interface in sage/libs/pari/gen.pyx, for some reason PARI is called directly in sage/rings/complex_double.pyx. This interface misses some features, such as cleaning up the PARI stack :-)

This code goes back to

changeset:   1292:28dfa54b6a23
parent:      1273:97f9271f8637
user:        William Stein <wstein@gmail.com>
date:        Sun Sep 24 23:13:32 2006 -0700
summary:     Finished the 2nd draft of the double precision complex numbers.

Solution: use the proper PARI interface instead.

Attachments (1)

14082_pari_complex_double.patch (12.8 KB) - added by jdemeyer 7 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:2 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:3 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:4 Changed 7 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Description modified (diff)

comment:5 Changed 7 years ago by jdemeyer

  • Status changed from new to needs_review

comment:6 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:7 Changed 7 years ago by roed

  • Reviewers set to David Roe
  • Status changed from needs_review to positive_review

This looks good, and the following change means that our eta function now agrees with Mathematica (and PARI as well)

-            sage: CDF(10^15,0.1).eta()     # slightly random-ish arch dependent output
-            -0.121339721991 - 0.19619461894*I   
+            sage: CDF(10^15, 0.1).eta()  # abs tol 1e-10
+            -0.115342592727 - 0.19977923088*I

Changed 7 years ago by jdemeyer

comment:8 Changed 7 years ago by jdemeyer

  • Dependencies set to #13618

Rebased.

comment:9 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.8.beta3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.