Re: [Python-Dev] Re: marshal / unmarshal

2005-04-15 Thread Jack Jansen
On 14-apr-05, at 15:08, David Robinow wrote: On 4/11/05, Tim Peters <[EMAIL PROTECTED]> wrote: Heh. I have a vague half-memory of _some_ box that stored the two 4-byte "words" in an IEEE double in one order, but the bytes within each word in the opposite order. It's always something ... I believ

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-14 Thread LD \"Gus\" Landis
Hi, For AIX: Python 2.2 (#1, Feb 17 2003, 21:43:03) [C] on aix4 Type "help", "copyright", "credits" or "license" for more information. >>> import marshal >>> marshal.dumps(1e1) 'f\x03INF' >>> marshal.loads(marshal.dumps(1e1)) INF >>> float("INF") INF >>> float("NaN") NaNQ >>> On 4/9/0

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-14 Thread David Robinow
On 4/11/05, Tim Peters <[EMAIL PROTECTED]> wrote: > Heh. I have a vague half-memory of _some_ box that stored the two > 4-byte "words" in an IEEE double in one order, but the bytes within > each word in the opposite order. It's always something ... I believe this was the Floating Instruction Se

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-12 Thread Michael Hudson
Tim Peters <[EMAIL PROTECTED]> writes: > ... > > [mwh] I recall stories of machines that stored the bytes of long in some crazy order like that. I think Python would already be broken on such a system, but, also, don't care. > > [Tim] >>> Python does very little that depends on int

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-12 Thread Tim Peters
... [mwh] >>> I recall stories of machines that stored the bytes of long in some >>> crazy order like that. I think Python would already be broken on such >>> a system, but, also, don't care. [Tim] >> Python does very little that depends on internal native byte order, >> and C hides it in the ab

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-12 Thread Michael Hudson
My mail is experincing random delays of up to a few hours at the moment. I wrote this before I saw your comments on my patch. Tim Peters <[EMAIL PROTECTED]> writes: > [Michael Hudson] >> I've just submitted http://python.org/sf/1180995 which adds format >> codes for binary marshalling of floats

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-11 Thread Tim Peters
[Michael Hudson] > I've just submitted http://python.org/sf/1180995 which adds format > codes for binary marshalling of floats if version > 1, but it doesn't > quite have the effect I expected (see below): > >>> inf = 1e308*1e308 > >>> nan = inf/inf > >>> marshal.dumps(nan, 2) > Traceback (most re

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-11 Thread Michael Hudson
I've just submitted http://python.org/sf/1180995 which adds format codes for binary marshalling of floats if version > 1, but it doesn't quite have the effect I expected (see below): >>> inf = 1e308*1e308 >>> nan = inf/inf >>> marshal.dumps(nan, 2) Traceback (most recent call last): File "", lin

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-11 Thread Tim Peters
... [mwh] > OK, so the worst that could happen here is that moving marshal data > from one box to another could turn one sort of NaN into another? Right. Assuming source and destination boxes both use 754 format, and the implementation adjusts endianess if necessary. Heh. I have a vague half-m

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-11 Thread Michael Hudson
Tim Peters <[EMAIL PROTECTED]> writes: > [Tim] >>> The 754 standard doesn't say anything about how the difference between >>> signaling and quiet NaNs is represented. So it's possible that a qNaN >>> on one box would "look like" an sNaN on a different box, and vice >>> versa. But since most peop

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-11 Thread Tim Peters
[Tim] >> The 754 standard doesn't say anything about how the difference between >> signaling and quiet NaNs is represented. So it's possible that a qNaN >> on one box would "look like" an sNaN on a different box, and vice >> versa. But since most people run with all FPU traps disabled, and >> Pyt

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-11 Thread Michael Hudson
Tim Peters <[EMAIL PROTECTED]> writes: > The 754 standard doesn't say anything about how the difference between > signaling and quiet NaNs is represented. So it's possible that a qNaN > on one box would "look like" an sNaN on a different box, and vice > versa. But since most people run with all

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-10 Thread Alex Martelli
On Apr 10, 2005, at 13:44, Skip Montanaro wrote: Michael> I suppose one could jsut do it unconditionally and wait for one Michael> of the three remaining VAX users[2] to compile Python 2.5 and Michael> then notice. You forgot the two remaining CRAY users. Since their machines are so

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-10 Thread Tim Peters
[mwh] > OTOH, the implementation has this comment: > > /* > * _PyFloat_{Pack,Unpack}{4,8}. See floatobject.h. > * > * TODO: On platforms that use the standard IEEE-754 single and double > * formats natively, these routine

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-10 Thread Skip Montanaro
Michael> I suppose one could jsut do it unconditionally and wait for one Michael> of the three remaining VAX users[2] to compile Python 2.5 and Michael> then notice. You forgot the two remaining CRAY users. Since their machines are so much more powerful than VAXen, they have much mor

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-10 Thread Michael Hudson
Tim Peters <[EMAIL PROTECTED]> writes: > marshal shouldn't be representing doubles as decimal strings to begin > with. All code for (de)serialing C doubles should go thru > _PyFloat_Pack8() and _PyFloat_Unpack8(). cPickle (proto >= 1) and > struct (std mode) already do; marshal is the oddball. >

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-10 Thread Tim Peters
marshal shouldn't be representing doubles as decimal strings to begin with. All code for (de)serialing C doubles should go thru _PyFloat_Pack8() and _PyFloat_Unpack8(). cPickle (proto >= 1) and struct (std mode) already do; marshal is the oddball. But as the docs (floatobject.h) for these say:

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-09 Thread Martin v. Löwis
Skip Montanaro wrote: > Martin> Yet, this *still* is a platform dependence. Python makes no > Martin> guarantee that 1e1000 is a supported float literal on any > Martin> platform, and indeed, on your platform, 1e1000 is not supported > Martin> on your platform. > > Are float("inf")

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-09 Thread Skip Montanaro
Martin> Yet, this *still* is a platform dependence. Python makes no Martin> guarantee that 1e1000 is a supported float literal on any Martin> platform, and indeed, on your platform, 1e1000 is not supported Martin> on your platform. Are float("inf") and float("nan") supported every

Re: [Python-Dev] Re: marshal / unmarshal

2005-04-09 Thread Martin v. Löwis
Terry Reedy wrote: > The particular issue here is not platform dependence as such but > within-platform usage dependence, as in the same code giving radically > different answers in a standard interactive console window and an idle > window, or when you run it the first time (from xx.py) versus