#15921: work around Maxima fpprintprec bug and other ARM-specific problems
-------------------------------------+-------------------------------------
Reporter: dimpase | Owner:
Type: defect | Status: needs_review
Priority: major | Milestone: sage-6.3
Component: calculus | Resolution:
Keywords: Maxima, | Merged in:
fpprintprec, ARM | Reviewers:
Authors: | Work issues:
Report Upstream: Reported | Commit:
upstream. Developers acknowledge | 079bb9af4f12892268a19f0d218ac96bd72466f4
bug. | Stopgaps:
Branch: |
u/dimpase/arm_fixes_etc |
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by pbruin):
This seems to correctly set the `fpprintprec`; on my x86_64 system it
leads to lots of doctest failures where the number of digits printed is
now one less than before.
{{{
#!diff
diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py
index 7603881..7a36885 100644
--- a/src/sage/interfaces/maxima.py
+++ b/src/sage/interfaces/maxima.py
@@ -136,6 +136,8 @@
http://maxima.sourceforge.net/docs/intromax/intromax.html.
sage: maxima.eval('fpprec : 100')
'100'
+ sage: maxima.eval('fpprintprec : 100')
+ '100'
sage: a.bfloat()
8.20121933088197564152489730020812442785204843859314941221237124017312418754011041266612384955016056b1
@@ -362,6 +364,8 @@ Obtaining digits of `\pi`::
sage: maxima.eval('fpprec : 100')
'100'
+ sage: maxima.eval('fpprintprec : 100')
+ '100'
sage: maxima(pi).bfloat()
3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068b0
@@ -594,6 +598,12 @@ class Maxima(MaximaAbstract, Expect):
# Remove limit on the max heapsize (since otherwise it defaults
# to 256MB with ECL).
self._sendline(":lisp (ext:set-limit 'ext:heap-size 0)")
+
+ # Adjust the precision (see Trac #15921)
+ self._sendline('fpprintprec : 15;')
+ s = self._eval_line('1/3.0;')
+ self._sendline('fpprintprec : {};'.format(30 - s.count('3')))
+
self._eval_line('0;')
def __reduce__(self):
diff --git a/src/sage/interfaces/maxima_lib.py
b/src/sage/interfaces/maxima_lib.py
index 643ac0f..5c94370 100644
--- a/src/sage/interfaces/maxima_lib.py
+++ b/src/sage/interfaces/maxima_lib.py
@@ -331,6 +331,12 @@ class MaximaLib(MaximaAbstract):
self.__init_code = init_code
MaximaAbstract.__init__(self,"maxima_lib")
+
+ # Adjust the precision (see Trac #15921)
+ self._eval_line('fpprintprec : 15')
+ s = self._eval_line('1/3.0;')
+ self._eval_line('fpprintprec : {}'.format(30 - s.count('3')))
+
self.__seq = 0
def _coerce_from_special_method(self, x):
diff --git a/src/sage/symbolic/constants.py
b/src/sage/symbolic/constants.py
index 6f76834..5917fba 100644
--- a/src/sage/symbolic/constants.py
+++ b/src/sage/symbolic/constants.py
@@ -160,6 +160,8 @@ EXAMPLES: Arithmetic with constants
sage: pim = maxima(pi)
sage: maxima.eval('fpprec : 100')
'100'
+ sage: maxima.eval('fpprintprec: 100')
+ '100'
sage: pim.bfloat()
3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068b0
}}}
Do you think this approach would be worth trying?
--
Ticket URL: <http://trac.sagemath.org/ticket/15921#comment:14>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.