Opened 7 years ago

Closed 7 years ago

#13033 closed defect (fixed)

Conversion PARI -> RR fails for large exponents

Reported by: jdemeyer Owned by: was
Priority: major Milestone: sage-5.1
Component: interfaces Keywords: sd40.5 PARI MPFR exponent
Cc: zimmerma, benjaminfjones, was Merged in: sage-5.1.beta2
Authors: Jeroen Demeyer Reviewers: William Stein
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

sage: a = pari(10^6).erfc()
sage: a
3.15934761259943 E-434294481910
sage: a.debug()
[&=0000000000f84d10] REAL(lg=3):0400000000000003 (+,expo=-1442695040910):5ffffeb018acb072 9b56c6d11005bdc3
sage: RR(a)
5.64243263573681e124617551

The exponent changed from -434294481910 to 124617551.

Attachments (1)

13033_pari_to_mpfr.patch (12.6 KB) - added by jdemeyer 7 years ago.

Download all attachments as: .zip

Change History (11)

comment:1 Changed 7 years ago by was

Note that

sage: RealField(10000)('1e-434294481910') == 0
True
sage: RealField()('1e-434294481910') == 0
True

so in your example above, RR(a) should be 0.

comment:2 Changed 7 years ago by jdemeyer

  • Cc zimmerma added
  • Description modified (diff)

comment:3 Changed 7 years ago by benjaminfjones

  • Cc benjaminfjones added

comment:4 Changed 7 years ago by was

jdmeyer figured this out -- the issue was "int" versus "long"... a patch will be forthcoming.

comment:5 Changed 7 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Keywords PARI MPFR exponent added

comment:6 Changed 7 years ago by jdemeyer

  • Cc was added
  • Status changed from new to needs_review

Passes all long doctests on x86_64, passes all longs tests in sage/rings on ppc32.

Last edited 7 years ago by jdemeyer (previous) (diff)

comment:7 Changed 7 years ago by was

  • Status changed from needs_review to positive_review

This looks really good to me! I've run some tests in some places (sage.math and OS X). I've not tested on 32-bit. I really like how the functions are tested.

Changed 7 years ago by jdemeyer

comment:8 Changed 7 years ago by jdemeyer

Fixed exception formatting (no capital, no dot).

comment:9 Changed 7 years ago by jdemeyer

  • Reviewers set to William Stein

comment:10 Changed 7 years ago by jdemeyer

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