homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chrish42
Recipients
Date 2006年05月08日.17:05:07
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
When using struct to unpack floats, I'm getting
inconsistent results when using the '<d' specification
instead of '@d' on a little-endian machine (Intel).
Here's a short python snippet that demonstrates the
problem.
import sys, struct
s = '\x00\x00\x00\x00\x00\x00\xf8\x7f'
>>> sys.byteorder
'little'
# This is correct...
>>> struct.unpack('@d', s)
(nan,)
# These should be equivalent for unpacking a single 
# double on little-endian arch... but they're not.
>>> struct.unpack('<d', s)
(inf,)
>>> struct.unpack('=d', s)
(inf,)
History
Date User Action Args
2007年08月23日 14:39:55adminlinkissue1483963 messages
2007年08月23日 14:39:55admincreate

AltStyle によって変換されたページ (->オリジナル) /