[Numpy-discussion] problem with float64's str()
Charles R Harris
Thu Apr 10 19:31:47 CDT 2008
On Fri, Apr 4, 2008 at 1:47 PM, Robert Kern <email@example.com> wrote:
> On Fri, Apr 4, 2008 at 9:56 AM, Will Lee <firstname.lastname@example.org> wrote:
> > I understand the implication for the floating point comparison and the
> > for allclose. However, I think in a doctest context, this behavior
> > the doc much harder to read.
> Tabling the issue of the fact that we changed behavior for a moment,
> this is a fundamental problem with using doctests as unit tests for
> numerical code. The floating point results that you get *will* be
> different on different machines, but the code will still be correct.
> Using allclose() and similar techniques are the best tools available
> (although they still suck). Relying on visual representations of these
> results is simply an untenable strategy. Note that the string
> representation of NaNs and Infs are completely different across
> That said, str(float_numpy_scalar) really should have the same rules
> as str(some_python_float).
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion