[mpmath] r1236 committed - gmpy2 can be compiled without floating point support. This triggered a...

3 views
Skip to first unread message

mpm...@googlecode.com

unread,
Jun 5, 2011, 11:00:48 PM6/5/11
to mpmath-...@googlegroups.com
Revision: 1236
Author: casevh
Date: Sun Jun 5 19:55:02 2011
Log: gmpy2 can be compiled without floating point support. This
triggered a problem in atan_newton() where math.atan(MPZ/float) is used.
gmpy (gmpy2 with MPFR enabled) will return an mpf (or mpfr) which is then
converted to a float by math.atan(). I converted the integer argument to a
Python long so that the division result is a float.
http://code.google.com/p/mpmath/source/detail?r=1236

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

=======================================
--- /trunk/mpmath/libmp/libelefun.py Sat Jan 8 14:54:03 2011
+++ /trunk/mpmath/libmp/libelefun.py Sun Jun 5 19:55:02 2011
@@ -783,9 +783,9 @@

def atan_newton(x, prec):
if prec >= 100:
- r = math.atan((x>>(prec-53))/2.0**53)
+ r = math.atan(long((x>>(prec-53)))/2.0**53)
else:
- r = math.atan(x/2.0**prec)
+ r = math.atan(long(x)/2.0**prec)
prevp = 50
r = MPZ(int(r * 2.0**53) >> (53-prevp))
extra_p = 50

Reply all
Reply to author
Forward
0 new messages