@@ -2611,24 +2611,6 @@ cdef class Gen(Gen_base):
26112611 """
26122612 return self .new_ref(gel(self .fixGEN(), 2 ))
26132613
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-
26322614 def round (x , bint estimate = False ):
26332615 """
26342616 round(x,estimate=False): If x is a real number, returns x rounded
@@ -3686,6 +3668,19 @@ cdef class Gen(Gen_base):
36863668 [1, 1/10000000019*x]
36873669 >>> pari(f).nfbasis(fa=[2,p]) # Equivalent with the above
36883670 [1, 1/10000000019*x]
3671+
3672+ The following alternative syntax closer to PARI/GP can be used
3673+
3674+ >>> pari.nfbasis([f, 1])
3675+ [1, x]
3676+ >>> pari.nfbasis(f)
3677+ [1, 1/10000000019*x]
3678+ >>> pari.nfbasis([f, 10**6])
3679+ [1, x]
3680+ >>> pari.nfbasis([f, "[2,2; %s ,2]"%p ])
3681+ [1, 1/10000000019*x]
3682+ >>> pari.nfbasis([f, [2,p]])
3683+ [1, 1/10000000019*x]
36893684 """
36903685 cdef Gen t0
36913686 cdef GEN g0
@@ -4115,38 +4110,6 @@ cdef class Gen(Gen_base):
41154110 sig_on()
41164111 return new_gen(factorpadic(self .g, t0.g, r))
41174112
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-
41504113 def ncols (self ):
41514114 """
41524115 Return the number of columns of self.
@@ -4699,20 +4662,14 @@ cpdef Gen objtogen(s):
46994662
47004663 Conversion from reals uses the real's own precision:
47014664
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
4665+ >>> a = pari(1.2); a, a.type(), a.bitprecision()
4666+ (1.20000000000000, 't_REAL', 64)
47084667
47094668 Conversion from strings uses the current PARI real precision.
47104669 By default, this is 64 bits:
47114670
4712- >>> a = pari('1.2'); a, a.type()
4713- (1.20000000000000, 't_REAL')
4714- >>> a.precision() == (4 if bitness == '32' else 3)
4715- True
4671+ >>> a = pari('1.2'); a, a.type(), a.bitprecision()
4672+ (1.20000000000000, 't_REAL', 64)
47164673
47174674 Unicode and bytes work fine:
47184675
@@ -4725,11 +4682,10 @@ cpdef Gen objtogen(s):
47254682
47264683 >>> pari.set_real_precision(35) # precision in decimal digits
47274684 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
4685+ >>> a = pari('Pi'); a, a.type(), a.bitprecision()
4686+ (3.1415926535897932384626433832795029, 't_REAL', 128)
4687+ >>> a = pari('1.2'); a, a.type(), a.bitprecision()
4688+ (1.2000000000000000000000000000000000, 't_REAL', 128)
47334689
47344690 Set the precision to 15 digits for the remaining tests:
47354691
0 commit comments