Lesson 5: Floating Point Numbers, Successive Refinement, Finding Roots
On my computer (Windows 7 x64) running Python 3.2.2 some of the output generator by Prof. Guttag did not match my own. For example when raising to the 2 *** 1000 does not print the L in my case. There were other differences. I'm attaching the handout for this lecture pasted and formatted from the PDF. Hope this helps.
Just a quick question, which version of Python was used in the lecture?
?
" ...sys.maxint is always set to the maximum plain integer value for the current platform..." http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex AMD Athlon II x4 645 Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32 my maxint is 2147483647 which is 7FFF FFFF ... all but bit 31
and one more makes it 'long' 2147483648L
In 2.7.2 I get the same answer although in 3.2.2 I get the following: >>> import sys >>> sys.maxint Traceback (most recent call last): File "<pyshell#7>", line 1, in <module> sys.maxint AttributeError: 'module' object has no attribute 'maxint' >>>
i wonder why?
Join our real-time social learning platform and learn together with your friends!