Opened 13 years ago

Closed 12 years ago

Last modified 5 years ago

#8157 closed defect (fixed)

why the bit limit of 2^24 in RealField?

Reported by: zimmerma Owned by: AlexGhitza
Priority: major Milestone: sage-4.3.4
Component: basic arithmetic Keywords:
Cc: Merged in: sage-4.3.4.alpha0
Authors: François Maltey, Paul Zimmermann Reviewers: Alex Ghitza
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by AlexGhitza)

sage: R = RealField(16777217)
ValueError                                Traceback (most recent call last)

/users/caramel/zimmerma/.sage/temp/\ in <module>()

 in sage.rings.real_mpfr.RealField_constructor (sage/rings/real_mpfr.c:3723)()

 in sage.rings.real_mpfr.RealField.__init__ (sage/rings/real_mpfr.c:3945)()

ValueError: prec (=16777217) must be >= 2 and <= 16777216.

Note that 2^24 bits is only slightly above 5M digits, which is quite small (Fabrice Bellard recently computed 2700 billions of digits of Pi on a personal desktop, i.e., about 500,000 times more).

Attachments (2)

trac_8157.patch (1.0 KB) - added by zimmerma 12 years ago.
trac_8157-doctest.patch (922 bytes) - added by AlexGhitza 12 years ago.
apply after the first patch

Download all attachments as: .zip

Change History (7)

Changed 12 years ago by zimmerma

comment:1 Changed 12 years ago by zimmerma

  • Authors set to Francois Maltey and Paul Zimmermann
  • Status changed from new to needs_review

The attached patch solves this problem, for example:

sage: time a=n(pi,digits=10^7)
CPU times: user 113.52 s, sys: 0.22 s, total: 113.73 s
Wall time: 114.21 s

comment:2 Changed 12 years ago by AlexGhitza

  • Description modified (diff)

comment:3 Changed 12 years ago by AlexGhitza

  • Reviewers set to Alex Ghitza
  • Status changed from needs_review to positive_review

Looks good and passes tests.

The referee patch adds a couple of doctests (bug fixes should be accompanied by doctests so that we don't regress again). The slightly weird "OverflowError?: ..." in the second test is due to the fact that the error messages are slightly different on 32-bit than on 64-bit machines.

Changed 12 years ago by AlexGhitza

apply after the first patch

comment:4 Changed 12 years ago by mvngu

  • Authors changed from Francois Maltey and Paul Zimmermann to Francois Maltey, Paul Zimmermann
  • Merged in set to sage-4.3.4.alpha0
  • Resolution set to fixed
  • Status changed from positive_review to closed

Merged in this order:

  1. trac_8157.patch
  2. trac_8157-doctest.patch

Paul: I merged trac_8157.patch, putting the ticket number in the commit message.

comment:5 Changed 5 years ago by chapoton

  • Authors changed from Francois Maltey, Paul Zimmermann to François Maltey, Paul Zimmermann


Note: See TracTickets for help on using tickets.