Skip to content

Commit

Permalink
Adapt new_gen_from_real_mpfr_element to pari 2.17 changes in precision
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio-rojas committed Oct 2, 2024
1 parent 0c5d88d commit a6acbfb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sage/libs/pari/convert_sage_real_mpfr.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cpdef Gen new_gen_from_real_mpfr_element(RealNumber self):

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

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

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

0 comments on commit a6acbfb

Please sign in to comment.