[Python-checkins] python/dist/src/Misc NEWS,1.699,1.700

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 20 Mar 2003 10:32:51 -0800


Update of /cvsroot/python/python/dist/src/Misc
In directory sc8-pr-cvs1:/tmp/cvs-serv9471/Misc

Modified Files:
	NEWS 
Log Message:
SF bug 705836: struct.pack of floats in non-native endian order

pack_float, pack_double, save_float:  All the routines for creating
IEEE-format packed representations of floats and doubles simply ignored
that rounding can (in rare cases) propagate out of a long string of
1 bits.  At worst, the end-off carry can (by mistake) interfere with
the exponent value, and then unpacking yields a result wrong by a factor
of 2.  In less severe cases, it can end up losing more low-order bits
than intended, or fail to catch overflow *caused* by rounding.

Bugfix candidate, but I already backported this to 2.2.

In 2.3, this code remains in severe need of refactoring.


Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.699
retrieving revision 1.700
diff -C2 -d -r1.699 -r1.700
*** NEWS	19 Mar 2003 00:35:35 -0000	1.699
--- NEWS	20 Mar 2003 18:32:03 -0000	1.700
***************
*** 38,41 ****
--- 38,49 ----
  -----------------
  
+ - The platform-independent routines for packing floats in IEEE formats
+   (struct.pack's <f, >f, <d, and >d codes; pickle and cPickle's protocol 1
+   pickling of floats) ignored that rounding can cause a carry to
+   propagate.  The worst consequence was that, in rare cases, <f and >f
+   could produce strings that, when unpacked again, were a factor of 2
+   away from the original float.  This has been fixed.  See SF bug
+   #705836.
+ 
  - New function time.tzset() provides access to the C library tzet()
    function, if supported.  (SF patch #675422.)