#2567: import MPFR_PREC_MAX from mpfr.h instead of hard coding it to the 32 bit
limit
------------------------------+---------------------------------------------
Reporter: was | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone: sage-3.4.1
Component: basic arithmetic | Resolution:
Keywords: |
------------------------------+---------------------------------------------
Changes (by mabshoff):
* summary: remove limitation on computing digits of pi using mpfr =>
import MPFR_PREC_MAX from mpfr.h instead of
hard coding it to the 32 bit limit
Old description:
> {{{
> > > CODE:
> >
> > > s = pi.str(3000000*log(10,2))
> > > o = open('/Users/ericahls/Desktop/file.txt','w')
> > > o.write(str(s))
> > > o.close()
> >
> > > --- Trying to get out to the farthest decimal point of PI I can.
> >
> > > Error message:
> >
> > > Traceback (most recent call last): o.write(str(s))
> > > File "/Applications/sage/local/lib/python2.5/site-packages/sage/
> > > functions/functions.py", line 140, in str
> > > raise ValueError, "Number of bits must be at most 2^23."
> > > ValueError: Number of bits must be at most 2^23.
> >
> > > ----If i Put 2000000 instead 0f 3000000 the equation works. much
> over
> > > 2 million the equation breaks dwon.
> >
> > I think that 2^23 is a bound in mpfr, and Sage uses mpfr to
> > compute digits of pi. I don't know if one can compute more than
> > about 2^23 digits using mpfr.
> >
> > William
>
> Yes we can. The issue was that MPFR used the stack instead of the heap
> for certain operations [even when told not to use alloca] and would
> smash it therefore with large number of digits. That has been fixed in
> MPFR 2.3.1 (which we include) and all we need to do is to raise or
> remove the limit in our code and do some testing. Care to open a
> ticket?
>
> -- Mabshoff
> }}}
New description:
The discussion below is besides the point. The main issue is that we
define MPFR_PREC_MAX in Sage's sources instead of pulling it in from
mpfr.h. We do hard code the 32 bit value, so on 64 bit boxen we limit the
user to much lower precision than is actually technically feasible as
pointed out below.
Cheers,
Michael
{{{
> > CODE:
>
> > s = pi.str(3000000*log(10,2))
> > o = open('/Users/ericahls/Desktop/file.txt','w')
> > o.write(str(s))
> > o.close()
>
> > --- Trying to get out to the farthest decimal point of PI I can.
>
> > Error message:
>
> > Traceback (most recent call last): o.write(str(s))
> > File "/Applications/sage/local/lib/python2.5/site-packages/sage/
> > functions/functions.py", line 140, in str
> > raise ValueError, "Number of bits must be at most 2^23."
> > ValueError: Number of bits must be at most 2^23.
>
> > ----If i Put 2000000 instead 0f 3000000 the equation works. much
over
> > 2 million the equation breaks dwon.
>
> I think that 2^23 is a bound in mpfr, and Sage uses mpfr to
> compute digits of pi. I don't know if one can compute more than
> about 2^23 digits using mpfr.
>
> William
Yes we can. The issue was that MPFR used the stack instead of the heap
for certain operations [even when told not to use alloca] and would
smash it therefore with large number of digits. That has been fixed in
MPFR 2.3.1 (which we include) and all we need to do is to raise or
remove the limit in our code and do some testing. Care to open a
ticket?
-- Mabshoff
}}}
Comment:
This discussion is very interesting, but it should not happen in trac, but
on some mailing list since there people actually tend to see it. Trac's
audience is rather limited and the comment section isn't meant for
discussions :)
I have changed the ticket to reflect Paul's pointer about pulling in
MPFR_PREC_MAX from mpfr.h
Cheers,
Michael
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/2567#comment:7>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---