[issue2487] ldexp(x,n) misbehaves when abs(n) is large

2008-05-09 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: I've committed a (slightly reworked) version of this patch in r62948. Closing this issue; the problem with 1 >> 2**31 is a separate issue. Thanks for the report, Fredrik. -- resolution: -> fixed status: open -> closed ___

[issue2487] ldexp(x,n) misbehaves when abs(n) is large

2008-05-08 Thread Fredrik Johansson
Fredrik Johansson <[EMAIL PROTECTED]> added the comment: I'm not qualified to comment on the implementation. The test cases all look right. __ Tracker <[EMAIL PROTECTED]> __ ___

[issue2487] ldexp(x,n) misbehaves when abs(n) is large

2008-04-26 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: Here's a patch that should fix ldexp(x, large_int), as follows: ldexp(x, n) = x if x is a NaN, zero or infinity ldexp(x, n) = copysign(0., x) for x finite and nonzero, n large and -ve ldexp(x, n) -> OverflowError for x finite and nonzero, n l

[issue2487] ldexp(x,n) misbehaves when abs(n) is large

2008-03-26 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: There are similar problems with integer shifts. In the trunk: >>> 1>>(2**40) Traceback (most recent call last): File "", line 1, in OverflowError: long int too large to convert to int and in Python 3.0: >>> 1>>(2**40) Traceback (most re

[issue2487] ldexp(x,n) misbehaves when abs(n) is large

2008-03-25 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: I agree that the second and fourth cases are bugs. The second case looks like a Windows only problem: I get the expected OverflowError on both OS X 10.5.2/Intel and SuSE Linux 10.2/i686. The fourth case is cross-platform, and occurs also f

[issue2487] ldexp(x,n) misbehaves when abs(n) is large

2008-03-25 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: ldexp(1.234, maxint) works as expected in our trunk-math branch. ldexp(1.234, -maxint-2) fails with the same error message. -- assignee: -> marketdickinson nosy: +marketdickinson, tiran priority: -> normal versions: +Python 2.6 _

[issue2487] ldexp(x,n) misbehaves when abs(n) is large

2008-03-25 Thread Fredrik Johansson
New submission from Fredrik Johansson <[EMAIL PROTECTED]>: Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from math import ldexp >>> from sys import maxint >>> ldexp(1.234, maxint//2