Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
long int computations
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Jerry Hill, post: 4067479"] You didn't say what version of python you were using, but this seems to work for me in 2.6.4: Traceback (most recent call last): File "<pyshell#5>", line 1, in <module> float(long1) OverflowError: long int too large to convert to float 0.5 The "from __future__ import division" line gets python to return a float as the result of dividing two integers (or longs), instead of returning an integer. If I recall correctly, this has been available for quite a few python versions (since 2.2 maybe?), and has become the default in python 3. If you need to do integer division, you would use the // operator: 0L Hope that helps. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
long int computations
Top