<div dir="ltr">Yes, we should probably change this to use System.Double.ToString('G17')<div><br><div class="gmail_quote">On Thu, Sep 4, 2008 at 7:41 AM, Christian Muirhead <span dir="ltr"><<a href="mailto:christian.muirhead@resolversystems.com">christian.muirhead@resolversystems.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d">Michael Foord wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Pickle on IronPython doesn't preserve sufficient information to unpickle floats accurately:<br>
<br>
CPython:<br>
>>> a = 1 /3.0<br>
>>> import cPickle as pickle<br>
>>> pickle.loads(pickle.dumps(a)) == a<br>
</blockquote></div>
(Michael meant to say that this was True)<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
IronPython:<br>
>>> import cPickle as pickle<br>
>>> a = 1 /3.0<br>
>>> pickle.loads(pickle.dumps(a)) == a<br>
False<br>
<br>
This is actually causing us numerical errors in Resolver One. CPython is actually very careful about its string representation of floats so that this is possible.<br>
</blockquote>
<br></div>
I think it's because IP cPickle is relying on the .NET Double.ToString which isn't as truthful as cPython's repr.<br>
<br>
The issue's covered here: <a href="http://www.python.org/doc/current/tut/node16.html" target="_blank">http://www.python.org/doc/current/tut/node16.html</a><br>
<br>
xtian<br>
<br>
<br>
-- <br>
Christian Muirhead<br>
Resolver Systems<br>
<a href="mailto:christian.muirhead@resolversystems.com" target="_blank">christian.muirhead@resolversystems.com</a><br>
We're hiring! <a href="http://www.resolversystems.com/jobs/" target="_blank">http://www.resolversystems.com/jobs/</a><br>
<br>
<br>
Resolver Systems Ltd<br>
17a Clerkenwell Road, London EC1M 5RD, UK<br>
VAT No.: GB 893 5643 79 Registered in England and Wales as company number 5467329.<br>
Registered address: 843 Finchley Road, London NW11 8NA, UK<div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</div></div></blockquote></div><br></div></div>