[Numpy-discussion] `allclose` vs `assert_allclose`

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Jul 18 14:31:01 EDT 2014


>
>
> > Making the behavior of assert_allclose depending on whether desired is
> > exactly zero or 1e-20 looks too difficult to remember, and which desired
> I
> > use would depend on what I get out of R or Stata.
>
> I thought your whole point here was that 1e-20 and zero are
> qualitatively different values that you would not want to accidentally
> confuse? Surely R and Stata aren't returning exact zeros for small
> non-zero values like probability tails?
>
>
I was thinking of the case when we only see "pvalue < 1e-16" or something
like this, and we replace this by assert close to zero.
which would translate to `assert_allclose(pvalue, 0, atol=1e-16)`
with maybe an additional rtol=1e-11 if we have an array of pvalues where
some are "large" (>0.5).

It's not a very frequent case, mainly when we don't have access to the
underlying float numbers and only have the print representation.

Josef
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140718/cfa413cc/attachment.html>


More information about the NumPy-Discussion mailing list