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

Nathaniel Smith njs at pobox.com
Fri Jul 18 14:44:08 EDT 2014


On 18 Jul 2014 19:31, <josef.pktd at gmail.com> wrote:
>>
>>
>> > 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).

This example is also handled correctly by my proposal :-)

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


More information about the NumPy-Discussion mailing list