Skip to content

Commit a6acbfb

Browse files
committed
Adapt new_gen_from_real_mpfr_element to pari 2.17 changes in precision
1 parent 0c5d88d commit a6acbfb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sage/libs/pari/convert_sage_real_mpfr.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ cpdef Gen new_gen_from_real_mpfr_element(RealNumber self):
2828

2929
# We round up the precision to the nearest multiple of wordsize.
3030
cdef int rounded_prec
31-
rounded_prec = (self.prec() + wordsize - 1) & ~(wordsize - 1)
31+
rounded_prec = nbits2prec(self.prec())
3232

3333
# Yes, assigning to self works fine, even in Cython.
3434
if rounded_prec > prec:
@@ -48,7 +48,7 @@ cpdef Gen new_gen_from_real_mpfr_element(RealNumber self):
4848
exponent = mpfr_get_z_exp(mantissa, self.value)
4949

5050
# Create a PARI REAL
51-
pari_float = cgetr(2 + rounded_prec / wordsize)
51+
pari_float = cgetr(rounded_prec)
5252
pari_float[1] = evalexpo(exponent + rounded_prec - 1) + evalsigne(mpfr_sgn(self.value))
5353
mpz_export(&pari_float[2], NULL, 1, wordsize // 8, 0, 0, mantissa)
5454
mpz_clear(mantissa)

0 commit comments

Comments
 (0)