Skip to content

Commit 6d7c793

Browse files
Merge pull request #3 from tornaria/pari-2.17
Fix doctests for pari 2.17 on 32-bit
2 parents 631a539 + afe12d2 commit 6d7c793

File tree

11 files changed

+31
-58
lines changed

11 files changed

+31
-58
lines changed

src/sage/calculus/calculus.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,7 @@ def nintegral(ex, x, a, b,
792792
to high precision::
793793
794794
sage: gp.eval('intnum(x=17,42,exp(-x^2)*log(x))')
795-
'2.565728500561051474934096410 E-127' # 32-bit
796-
'2.5657285005610514829176211363206621657 E-127' # 64-bit
795+
'2.5657285005610514829176211363206621657 E-127'
797796
sage: old_prec = gp.set_real_precision(50)
798797
sage: gp.eval('intnum(x=17,42,exp(-x^2)*log(x))')
799798
'2.5657285005610514829173563961304957417746108003917 E-127'

src/sage/doctest/sources.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -766,11 +766,11 @@ def create_doctests(self, namespace):
766766
767767
sage: import sys
768768
sage: bitness = '64' if sys.maxsize > (1 << 32) else '32'
769-
sage: gp.get_precision() == 38 # needs sage.libs.pari
769+
sage: sys.maxsize == 2^63 - 1
770770
False # 32-bit
771771
True # 64-bit
772772
sage: ex = doctests[20].examples[11]
773-
sage: ((bitness == '64' and ex.want == 'True \n') # needs sage.libs.pari
773+
sage: ((bitness == '64' and ex.want == 'True \n')
774774
....: or (bitness == '32' and ex.want == 'False \n'))
775775
True
776776

src/sage/interfaces/gp.py

+14-28
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@
4848
::
4949
5050
sage: gp("a = intnum(x=0,6,sin(x))")
51-
0.03982971334963397945434770208 # 32-bit
52-
0.039829713349633979454347702077075594548 # 64-bit
51+
0.039829713349633979454347702077075594548
5352
sage: gp("a")
54-
0.03982971334963397945434770208 # 32-bit
55-
0.039829713349633979454347702077075594548 # 64-bit
53+
0.039829713349633979454347702077075594548
5654
sage: gp.kill("a")
5755
sage: gp("a")
5856
a
@@ -375,8 +373,7 @@ def get_precision(self):
375373
EXAMPLES::
376374
377375
sage: gp.get_precision()
378-
28 # 32-bit
379-
38 # 64-bit
376+
38
380377
"""
381378
return self.get_default('realprecision')
382379

@@ -396,15 +393,13 @@ def set_precision(self, prec):
396393
EXAMPLES::
397394
398395
sage: old_prec = gp.set_precision(53); old_prec
399-
28 # 32-bit
400-
38 # 64-bit
396+
38
401397
sage: gp.get_precision()
402398
57
403399
sage: gp.set_precision(old_prec)
404400
57
405401
sage: gp.get_precision()
406-
28 # 32-bit
407-
38 # 64-bit
402+
38
408403
"""
409404
return self.set_default('realprecision', prec)
410405

@@ -520,8 +515,7 @@ def set_default(self, var, value):
520515
sage: gp.set_default('realprecision', old_prec)
521516
115
522517
sage: gp.get_default('realprecision')
523-
28 # 32-bit
524-
38 # 64-bit
518+
38
525519
"""
526520
old = self.get_default(var)
527521
self._eval_line('default(%s,%s)' % (var, value))
@@ -547,8 +541,7 @@ def get_default(self, var):
547541
sage: gp.get_default('seriesprecision')
548542
16
549543
sage: gp.get_default('realprecision')
550-
28 # 32-bit
551-
38 # 64-bit
544+
38
552545
"""
553546
return eval(self._eval_line('default(%s)' % var))
554547

@@ -773,8 +766,7 @@ def _exponent_symbol(self):
773766
::
774767
775768
sage: repr(gp(10.^80)).replace(gp._exponent_symbol(), 'e')
776-
'1.0000000000000000000000000000000000000e80' # 64-bit
777-
'1.000000000000000000000000000e80' # 32-bit
769+
'1.0000000000000000000000000000000000000e80'
778770
"""
779771
return ' E'
780772

@@ -800,27 +792,23 @@ def new_with_bits_prec(self, s, precision=0):
800792
801793
sage: # needs sage.symbolic
802794
sage: pi_def = gp(pi); pi_def
803-
3.141592653589793238462643383 # 32-bit
804-
3.1415926535897932384626433832795028842 # 64-bit
795+
3.1415926535897932384626433832795028842
805796
sage: pi_def.precision()
806-
28 # 32-bit
807-
38 # 64-bit
797+
38
808798
sage: pi_150 = gp.new_with_bits_prec(pi, 150)
809799
sage: new_prec = pi_150.precision(); new_prec
810800
48 # 32-bit
811801
57 # 64-bit
812802
sage: old_prec = gp.set_precision(new_prec); old_prec
813-
28 # 32-bit
814-
38 # 64-bit
803+
38
815804
sage: pi_150
816805
3.14159265358979323846264338327950288419716939938 # 32-bit
817806
3.14159265358979323846264338327950288419716939937510582098 # 64-bit
818807
sage: gp.set_precision(old_prec)
819808
48 # 32-bit
820809
57 # 64-bit
821810
sage: gp.get_precision()
822-
28 # 32-bit
823-
38 # 64-bit
811+
38
824812
"""
825813
if precision:
826814
old_prec = self.get_real_precision()
@@ -856,11 +844,9 @@ class GpElement(ExpectElement, sage.interfaces.abc.GpElement):
856844
sage: loads(dumps(x)) == x
857845
False
858846
sage: x
859-
1.047197551196597746154214461 # 32-bit
860-
1.0471975511965977461542144610931676281 # 64-bit
847+
1.0471975511965977461542144610931676281
861848
sage: loads(dumps(x))
862-
1.047197551196597746154214461 # 32-bit
863-
1.0471975511965977461542144610931676281 # 64-bit
849+
1.0471975511965977461542144610931676281
864850
865851
The two elliptic curves look the same, but internally the floating
866852
point numbers are slightly different.

src/sage/interfaces/interface.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,7 @@ def _sage_repr(self):
10421042
::
10431043
10441044
sage: gp(10.^80)._sage_repr()
1045-
'1.0000000000000000000000000000000000000e80' # 64-bit
1046-
'1.000000000000000000000000000e80' # 32-bit
1045+
'1.0000000000000000000000000000000000000e80'
10471046
sage: mathematica('10.^80')._sage_repr() # optional - mathematica
10481047
'1.e80'
10491048

src/sage/interfaces/mathematica.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@
187187
Note that this agrees with what the PARI interpreter gp produces::
188188
189189
sage: gp('solve(x=1,2,exp(x)-3*x)')
190-
1.512134551657842473896739678 # 32-bit
191-
1.5121345516578424738967396780720387046 # 64-bit
190+
1.5121345516578424738967396780720387046
192191
193192
Next we find the minimum of a polynomial using the two different
194193
ways of accessing Mathematica::

src/sage/interfaces/mathics.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@
196196
Note that this agrees with what the PARI interpreter gp produces::
197197
198198
sage: gp('solve(x=1,2,exp(x)-3*x)')
199-
1.512134551657842473896739678 # 32-bit
200-
1.5121345516578424738967396780720387046 # 64-bit
199+
1.5121345516578424738967396780720387046
201200
202201
Next we find the minimum of a polynomial using the two different
203202
ways of accessing Mathics::

src/sage/interfaces/maxima_abstract.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1489,8 +1489,7 @@ def nintegral(self, var='x', a=0, b=1,
14891489
high precision very quickly::
14901490
14911491
sage: gp('intnum(x=0,1,exp(-sqrt(x)))')
1492-
0.5284822353142307136179049194 # 32-bit
1493-
0.52848223531423071361790491935415653022 # 64-bit
1492+
0.52848223531423071361790491935415653022
14941493
sage: _ = gp.set_precision(80)
14951494
sage: gp('intnum(x=0,1,exp(-sqrt(x)))')
14961495
0.52848223531423071361790491935415653021675547587292866196865279321015401702040079

src/sage/libs/pari/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,11 @@
165165
sage: e = pari([0,0,0,-82,0]).ellinit()
166166
sage: eta1 = e.elleta(precision=50)[0]
167167
sage: eta1.sage()
168-
3.6054636014326520859158205642077267748 # 64-bit
169-
3.605463601432652085915820564 # 32-bit
168+
3.6054636014326520859158205642077267748
170169
sage: eta1 = e.elleta(precision=150)[0]
171170
sage: eta1.sage()
172171
3.605463601432652085915820564207726774810268996598024745444380641429820491740 # 64-bit
173-
3.60546360143265208591582056420772677481026899659802474544 # 32-bit
172+
3.605463601432652085915820564207726774810268996598024745444380641430 # 32-bit
174173
"""
175174

176175
def _get_pari_instance():

src/sage/libs/pari/tests.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@
9494
[4, 2]
9595
9696
sage: int(pari(RealField(63)(2^63 - 1))) # needs sage.rings.real_mpfr
97-
9223372036854775807 # 32-bit
98-
9223372036854775807 # 64-bit
97+
9223372036854775807
9998
sage: int(pari(RealField(63)(2^63 + 2))) # needs sage.rings.real_mpfr
10099
9223372036854775810
101100
@@ -1231,8 +1230,7 @@
12311230
sage: e.ellheight([1,0])
12321231
0.476711659343740
12331232
sage: e.ellheight([1,0], precision=128).sage()
1234-
0.47671165934373953737948605888465305945902294218 # 32-bit
1235-
0.476711659343739537379486058884653059459022942211150879336 # 64-bit
1233+
0.476711659343739537379486058884653059459022942211150879336
12361234
sage: e.ellheight([1, 0], [-1, 1])
12371235
0.418188984498861
12381236
@@ -1806,12 +1804,11 @@
18061804
sage: e = pari([0,0,0,-82,0]).ellinit()
18071805
sage: eta1 = e.elleta(precision=50)[0]
18081806
sage: eta1.sage()
1809-
3.6054636014326520859158205642077267748 # 64-bit
1810-
3.605463601432652085915820564 # 32-bit
1807+
3.6054636014326520859158205642077267748
18111808
sage: eta1 = e.elleta(precision=150)[0]
18121809
sage: eta1.sage()
18131810
3.605463601432652085915820564207726774810268996598024745444380641429820491740 # 64-bit
1814-
3.60546360143265208591582056420772677481026899659802474544 # 32-bit
1811+
3.605463601432652085915820564207726774810268996598024745444380641430 # 32-bit
18151812
sage: from cypari2 import Pari
18161813
sage: pari = Pari()
18171814

src/sage/symbolic/constants.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
sage: gap(pi)
3939
pi
4040
sage: gp(pi)
41-
3.141592653589793238462643383 # 32-bit
42-
3.1415926535897932384626433832795028842 # 64-bit
41+
3.1415926535897932384626433832795028842
4342
sage: pari(pi)
4443
3.14159265358979
4544
sage: kash(pi) # optional - kash
@@ -63,8 +62,7 @@
6362
sage: RealField(15)(a) # 15 *bits* of precision
6463
5.316
6564
sage: gp(a)
66-
5.316218116357029426750873360 # 32-bit
67-
5.3162181163570294267508733603616328824 # 64-bit
65+
5.3162181163570294267508733603616328824
6866
sage: print(mathematica(a)) # optional - mathematica
6967
4 E
7068
--- + Pi
@@ -882,8 +880,7 @@ class Log2(Constant):
882880
sage: maxima(log2).float()
883881
0.6931471805599453
884882
sage: gp(log2)
885-
0.6931471805599453094172321215 # 32-bit
886-
0.69314718055994530941723212145817656807 # 64-bit
883+
0.69314718055994530941723212145817656807
887884
sage: RealField(150)(2).log()
888885
0.69314718055994530941723212145817656807550013
889886
"""

src/sage/symbolic/expression.pyx

+1-2
Original file line numberDiff line numberDiff line change
@@ -9798,8 +9798,7 @@ cdef class Expression(Expression_abc):
97989798
::
97999799
98009800
sage: gp('gamma(1+I)')
9801-
0.4980156681183560427136911175 - 0.1549498283018106851249551305*I # 32-bit
9802-
0.49801566811835604271369111746219809195 - 0.15494982830181068512495513048388660520*I # 64-bit
9801+
0.49801566811835604271369111746219809195 - 0.15494982830181068512495513048388660520*I
98039802
98049803
We plot the familiar plot of this log-convex function::
98059804

0 commit comments

Comments
 (0)