<br><br><div class="gmail_quote">On Fri, Apr 4, 2008 at 1:47 PM, Robert Kern <<a href="mailto:robert.kern@gmail.com">robert.kern@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Fri, Apr 4, 2008 at 9:56 AM, Will Lee <<a href="mailto:lee.will@gmail.com">lee.will@gmail.com</a>> wrote:<br>
> I understand the implication for the floating point comparison and the need<br>
> for allclose. However, I think in a doctest context, this behavior makes<br>
> the doc much harder to read.<br>
<br>
</div>Tabling the issue of the fact that we changed behavior for a moment,<br>
this is a fundamental problem with using doctests as unit tests for<br>
numerical code. The floating point results that you get *will* be<br>
different on different machines, but the code will still be correct.<br>
Using allclose() and similar techniques are the best tools available<br>
(although they still suck). Relying on visual representations of these<br>
results is simply an untenable strategy. Note that the string<br>
representation of NaNs and Infs are completely different across<br>
platforms.<br>
<br>
That said, str(float_numpy_scalar) really should have the same rules<br>
as str(some_python_float).<br>
<font color="#888888"></font></blockquote><div><br>For all different precisions? And what should the rules be. I note that numpy doesn't distinguish between repr and str, maybe we could specify different behavior for the two.<br>
<br>Chuck <br></div><br></div><br>