[mpmath] r1235 committed - Fix compatibility issue with latest version of gmpy2. Integer square r...

6 views
Skip to first unread message

mpm...@googlecode.com

unread,
Jun 5, 2011, 4:46:27 PM6/5/11
to mpmath-...@googlegroups.com
Revision: 1235
Author: casevh
Date: Sun Jun 5 13:45:58 2011
Log: Fix compatibility issue with latest version of gmpy2. Integer
square root has been renamed to isqrt(). Integer square root and remainder
has been renamed to isqrt_rem().
http://code.google.com/p/mpmath/source/detail?r=1235

Modified:
/trunk/mpmath/libmp/libintmath.py

=======================================
--- /trunk/mpmath/libmp/libintmath.py Sat Jan 8 15:52:03 2011
+++ /trunk/mpmath/libmp/libintmath.py Sun Jun 5 13:45:58 2011
@@ -298,8 +298,12 @@
sqrt_fixed2 = sqrt_fixed

if BACKEND == 'gmpy':
- isqrt_small = isqrt_fast = isqrt = gmpy.sqrt
- sqrtrem = gmpy.sqrtrem
+ if gmpy.version() >= '2':
+ isqrt_small = isqrt_fast = isqrt = gmpy.isqrt
+ sqrtrem = gmpy.isqrt_rem
+ else:
+ isqrt_small = isqrt_fast = isqrt = gmpy.sqrt
+ sqrtrem = gmpy.sqrtrem
elif BACKEND == 'sage':
isqrt_small = isqrt_fast = isqrt = \
getattr(sage_utils, "isqrt", lambda n: MPZ(n).isqrt())

Reply all
Reply to author
Forward
0 new messages