# HG changeset patch
# User Volker Braun <vbraun@stp.dias.ie>
# Date 1329868056 28800
# Node ID a202ee88c02e9765b6b8e4f4b34e4b6ea59944c0
# Parent 65c70eeebf8baba98019b8a8c03c0d4001f636a4
Trac #11666: Upgrade MPFR to 3.1.0
This patch removes the ugly hack that is no longer
necessary to have the same random numbers on 32 and 64 bit
diff git a/sage/rings/real_mpfr.pyx b/sage/rings/real_mpfr.pyx
a

b


928  928  """ 
929  929  cdef RealNumber x = self._new() 
930  930  cdef randstate rstate = current_randstate() 
931   if sizeof(long) == 4: 
932   # This is a gross hack that depends on the internals of 
933   # MPFR... but that's OK, because if MPFR changes it will 
934   # be instantly caught by the doctests above. 
935   # MPFR rounds up the precision to a multiple of the 
936   # current word size, then requests that many bits from 
937   # .gmp_state . So if (1 <= precision mod 64 <= 32), 
938   # a 64bit machine will request 32 more bits than a 32bit 
939   # machine, and the random numbers will get out of sync. 
940   # We work around this problem by requesting an extra 
941   # 32 bits on a 32bit machine. 
942   if 1 <= self.__prec % 64 <= 32: 
943   rstate.c_random() 
944  931  mpfr_urandomb(x.value, rstate.gmp_state) 
945  932  if min == 0 and max == 1: 
946  933  return x 