Re: curious problem with large numbers

2005-04-08 Thread Bengt Richter
On Fri, 08 Apr 2005 10:18:05 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >>>Aha! Same version (2.3.4): >>> >>>Idle: >>>>>> 1e1 >>>1.0 >>>>>> import struct; struct.pack('d', 1e1) >>>'\x00\x00\x00\x00\x00\x00\xf0?' >>>(which is actually 1.0) >

[Marshal Bug] Was Re: curious problem with large numbers

2005-04-08 Thread Michael Spencer
OK - I think this is it: My last post fingering pickle was almost but not quite right*. Actually the cuplrit is marshal, which produces the incorrect result that was noted. The bug has nothing to do with IDLE, except that it uses marshal for inter-process communication. Here's the failure cas

Re: curious problem with large numbers - Due to subprocess

2005-04-08 Thread Scott David Daniels
Michael Spencer wrote: Problem is associated with executing iteractive input in a subprocess. >python idle.py -n IDLE 1.1 No Subprocess >>> 1e1 1.#INF >>> Really good find. _very_ curious. Perhaps moving the float causes the problem? Where does the value get converted to text

Re: curious problem with large numbers - Due to subprocess - using pickle

2005-04-08 Thread Michael Spencer
Michael Spencer wrote: Problem is associated with executing iteractive input in a subprocess. >python idle.py -n IDLE 1.1 No Subprocess >>> 1e1 1.#INF >>> Michael It seems that the culprit is pickle - used to send messages between the IDLE shell and the execution server. >

Re: curious problem with large numbers - Due to subprocess

2005-04-08 Thread Michael Spencer
Scott David Daniels wrote: Scott David Daniels wrote: Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Scott David Daniels wrote: Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1 1.#INF >>> import struct

Re: curious problem with large numbers

2005-04-08 Thread Michael Spencer
Scott David Daniels wrote: Steve Holden wrote: Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Bengt Richter wrote: Aha! Same version (2.3.4): Idle: >>> 1e1 1.0 >>> import struct; struct.pack('d', 1e1) '\x00\x00\x00\x00\x00\x00\xf0?' (which is actually 1.0) python via command line (readline support): >>> 1e1 1.#INF >>> import struct; struct.pack('d', 1e1)

Re: curious problem with large numbers

2005-04-08 Thread Bengt Richter
On Fri, 08 Apr 2005 09:05:39 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: >> Scott David Daniels wrote: >> >>> Terry Reedy wrote: >>> On my Windows machine with 2.2.1, I get exactly what you expected: >>> 1e1 1.#INF ... If you g

Re: curious problem with large numbers

2005-04-08 Thread Scott David Daniels
Steve Holden wrote: Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also there

Re: curious problem with large numbers

2005-04-08 Thread Ivan Van Laningham
Hi All-- Windows XP, uwin running on Athlon XP 3000+: 0 [/c/users/ivanlan][1] python Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> 1e1 1.#INF >>> Metta, Ivan Michael Spencer wrote: > >

Re: curious problem with large numbers

2005-04-08 Thread Sion Arrowsmith
Michael Spencer <[EMAIL PROTECTED]> wrote: >Terry Reedy wrote: >> "Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote >>>However, on Windows (have tried on Mac, Linux) I get the following >>>behaviour: >>inf = 1e1 >>inf >>>1.0 >> On my Windows machine with 2.2.1, I get exactly what you expec

Re: curious problem with large numbers

2005-04-08 Thread Dan Bishop
Chris Fonnesbeck wrote: > I have been developing a python module for Markov chain Monte Carlo > estimation, in which I frequently compare variable values with a very > large number, that I arbitrarily define as: > > inf = 1e1 Don't forget that you can write your own Infinity. (Warning: Buggy

Re: curious problem with large numbers

2005-04-07 Thread Michael Spencer
Steve Holden wrote: Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also the

Re: curious problem with large numbers

2005-04-07 Thread Steve Holden
Scott David Daniels wrote: Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also there for 2.3.4 (May 25

Re: curious problem with large numbers

2005-04-07 Thread Michael Spencer
Terry Reedy wrote: "Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] However, on Windows (have tried on Mac, Linux) I get the following behaviour: inf = 1e1 inf 1.0 while I would have expected: 1.#INF On my Windows machine with 2.2.1, I get exactly what you ex

Re: curious problem with large numbers

2005-04-07 Thread Scott David Daniels
Terry Reedy wrote: On my Windows machine with 2.2.1, I get exactly what you expected: 1e1 1.#INF ... If you get wrong behavior on a later version, then a bug has been introduced somewhere, even perhaps in VC 7, used for 2.4. Nope, it is also there for 2.3.4 (May 25 2004, 21:17:02). This is no

Re: curious problem with large numbers

2005-04-07 Thread Terry Reedy
"Chris Fonnesbeck" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > However, on Windows (have tried on Mac, Linux) I get the following > behaviour: > inf = 1e1 inf > 1.0 > > while I would have expected: > > 1.#INF On my Windows machine with 2.2.1, I get exactly what y

Re: curious problem with large numbers

2005-04-07 Thread Laszlo Zsolt Nagy
I thought it will be the same for FreeBSD, but here are the results: FreeBSD 4.8 with Python 2.3.4 Python 2.3.4 (#2, Nov 10 2004, 05:08:39) [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4 Type "help", "copyright", "credits" or "license" for more information. >>> inf = 1e308*2 >>> inf Inf >>> float('Inf

Re: curious problem with large numbers

2005-04-07 Thread Kristian Zoerhoff
On Apr 7, 2005 3:34 PM, David M. Cooke > > I don't do Windows, so I can't say this will work, but try > > >>> inf = 1e308*2 I *do* do Windows, and that does work. The value of inf then becomes '1.#INF' as expected. Strangely, doing float('1.#INF') still fails on Windows. Weird, weird. -- Kr

Re: curious problem with large numbers

2005-04-07 Thread David M. Cooke
Chris Fonnesbeck <[EMAIL PROTECTED]> writes: > I have been developing a python module for Markov chain Monte Carlo > estimation, in which I frequently compare variable values with a very > large number, that I arbitrarily define as: > > inf = 1e1 > > However, on Windows (have tried on Mac, Lin

Re: curious problem with large numbers

2005-04-07 Thread Jeff Epler
You may want to read http://www.python.org/peps/pep-0754.html Part of the text reads The IEEE 754 standard defines a set of binary representations and algorithmic rules for floating point arithmetic. Included in the standard is a set of constants for representing special values, in

curious problem with large numbers

2005-04-07 Thread Chris Fonnesbeck
I have been developing a python module for Markov chain Monte Carlo estimation, in which I frequently compare variable values with a very large number, that I arbitrarily define as: inf = 1e1 However, on Windows (have tried on Mac, Linux) I get the following behaviour: >>> inf = 1e1 >>>