@@ -134,11 +134,14 @@ cdef extern from *:
134134 #endif
135135
136136 #if PARI_VERSION_CODE >= PARI_VERSION(2, 12, 0)
137- #define nfbasis(x, yptr, p) nfbasis(mkvec2(x, p), yptr)
137+ #define old_nfbasis(x, yptr, p) nfbasis(mkvec2(x, p), yptr)
138+ #else
139+ #define old_nfbasis nfbasis
138140 #endif
139141 """
140142 GEN new_nf_nfzk(GEN nf, GEN rnfeq)
141143 GEN new_nfeltup(GEN nf, GEN x, GEN zknf)
144+ GEN old_nfbasis(GEN x, GEN * y, GEN p)
142145
143146
144147cdef class Gen(Gen_base):
@@ -2611,24 +2614,6 @@ cdef class Gen(Gen_base):
26112614 """
26122615 return self .new_ref(gel(self .fixGEN(), 2 ))
26132616
2614- def precision (x , long n = - 1 ):
2615- """
2616- Change the precision of `x` to be `n`, where `n` is an integer.
2617- If `n` is omitted, output the real precision of `x`.
2618-
2619- INPUT:
2620-
2621- - ``x`` - gen
2622-
2623- - ``n`` - (optional) int
2624-
2625- OUTPUT: gen
2626- """
2627- if n <= 0 :
2628- return precision(x.g)
2629- sig_on()
2630- return new_gen(precision0(x.g, n))
2631-
26322617 def round (x , bint estimate = False ):
26332618 """
26342619 round(x,estimate=False): If x is a real number, returns x rounded
@@ -3686,6 +3671,19 @@ cdef class Gen(Gen_base):
36863671 [1, 1/10000000019*x]
36873672 >>> pari(f).nfbasis(fa=[2,p]) # Equivalent with the above
36883673 [1, 1/10000000019*x]
3674+
3675+ The following alternative syntax closer to PARI/GP can be used
3676+
3677+ >>> pari.nfbasis([f, 1])
3678+ [1, x]
3679+ >>> pari.nfbasis(f)
3680+ [1, 1/10000000019*x]
3681+ >>> pari.nfbasis([f, 10**6])
3682+ [1, x]
3683+ >>> pari.nfbasis([f, "[2,2; %s ,2]"%p ])
3684+ [1, 1/10000000019*x]
3685+ >>> pari.nfbasis([f, [2,p]])
3686+ [1, 1/10000000019*x]
36893687 """
36903688 cdef Gen t0
36913689 cdef GEN g0
@@ -3697,7 +3695,7 @@ cdef class Gen(Gen_base):
36973695 else :
36983696 g0 = NULL
36993697 sig_on()
3700- return new_gen(nfbasis (self .g, NULL , g0))
3698+ return new_gen(old_nfbasis (self .g, NULL , g0))
37013699
37023700 def nfbasis_d (self , long flag = 0 , fa = None ):
37033701 """
@@ -3731,7 +3729,7 @@ cdef class Gen(Gen_base):
37313729 else :
37323730 g0 = NULL
37333731 sig_on()
3734- ans = nfbasis (self .g, & disc, g0)
3732+ ans = old_nfbasis (self .g, & disc, g0)
37353733 return new_gens2(ans, disc)
37363734
37373735 def nfbasistoalg_lift (nf , x ):
@@ -4115,38 +4113,6 @@ cdef class Gen(Gen_base):
41154113 sig_on()
41164114 return new_gen(factorpadic(self .g, t0.g, r))
41174115
4118- def poldegree (self , var = None ):
4119- """
4120- Return the degree of this polynomial.
4121- """
4122- sig_on()
4123- n = poldegree(self .g, get_var(var))
4124- sig_off()
4125- return n
4126-
4127- def polisirreducible (self ):
4128- """
4129- f.polisirreducible(): Returns True if f is an irreducible
4130- non-constant polynomial, or False if f is reducible or constant.
4131- """
4132- sig_on()
4133- t = polisirreducible(self .g)
4134- clear_stack()
4135- return t != 0
4136-
4137- def polroots (self , unsigned long precision = 0 ):
4138- """
4139- Complex roots of the given polynomial using Schonhage's method,
4140- as modified by Gourdon.
4141- """
4142- sig_on()
4143- return new_gen(cleanroots(self .g, prec_bits_to_words(precision)))
4144-
4145- def rnfisnorm (self , T , long flag = 0 ):
4146- cdef Gen t0 = objtogen(T)
4147- sig_on()
4148- return new_gen(rnfisnorm(t0.g, self .g, flag))
4149-
41504116 def ncols (self ):
41514117 """
41524118 Return the number of columns of self.
@@ -4699,20 +4665,14 @@ cpdef Gen objtogen(s):
46994665
47004666 Conversion from reals uses the real's own precision:
47014667
4702- >>> a = pari(1.2); a, a.type()
4703- (1.20000000000000, 't_REAL')
4704- >>> import sys
4705- >>> bitness = '64' if sys.maxsize > (1 << 32) else '32'
4706- >>> a.precision() == (4 if bitness == '32' else 3)
4707- True
4668+ >>> a = pari(1.2); a, a.type(), a.bitprecision()
4669+ (1.20000000000000, 't_REAL', 64)
47084670
47094671 Conversion from strings uses the current PARI real precision.
47104672 By default, this is 64 bits:
47114673
4712- >>> a = pari('1.2'); a, a.type()
4713- (1.20000000000000, 't_REAL')
4714- >>> a.precision() == (4 if bitness == '32' else 3)
4715- True
4674+ >>> a = pari('1.2'); a, a.type(), a.bitprecision()
4675+ (1.20000000000000, 't_REAL', 64)
47164676
47174677 Unicode and bytes work fine:
47184678
@@ -4725,11 +4685,10 @@ cpdef Gen objtogen(s):
47254685
47264686 >>> pari.set_real_precision(35) # precision in decimal digits
47274687 15
4728- >>> a = pari('1.2'); a, a.type()
4729- (1.2000000000000000000000000000000000, 't_REAL')
4730- >>> bitness = '64' if sys.maxsize > (1 << 32) else '32'
4731- >>> a.precision() == (6 if bitness == '32' else 4)
4732- True
4688+ >>> a = pari('Pi'); a, a.type(), a.bitprecision()
4689+ (3.1415926535897932384626433832795029, 't_REAL', 128)
4690+ >>> a = pari('1.2'); a, a.type(), a.bitprecision()
4691+ (1.2000000000000000000000000000000000, 't_REAL', 128)
47334692
47344693 Set the precision to 15 digits for the remaining tests:
47354694
0 commit comments