[Numpy-discussion] deprecations for 1.6; assert_almost_equal
josef.pktd@gmai...
josef.pktd@gmai...
Mon Mar 7 09:05:50 CST 2011
On Mon, Mar 7, 2011 at 8:37 AM, Pauli Virtanen <pav@iki.fi> wrote:
> Mon, 07 Mar 2011 08:30:11 -0500, josef.pktd wrote:
> [clip]
>> assert_approx_equal checks for signigicant digits in decimal system,
>> which looks like it's easy to interpret.
>
> Ditto for tolerance=1e-7, which has the advantage that it's what
> "print abs(desired-actual)" prints.
Ok, it took me a while to figure out what the issue is, atol is more
intuitive then decimal, especially since decimal has the half
point/rounding behavior that I'm never quite sure about.
I initially thought the issue is between atol versus rtol versus nulp.
Is there a reason that assert_array_almost_equal uses
around(z, decimal) <= 10.0**(-decimal)
while the last part of assert _almost_equal is
if round(abs(desired - actual),decimal) != 0
>
>> I don't have much idea what a nulp is, and whether it's machine
>> dependent.
>
> It's the number of floating point values between the desired and the
> actual results --- this depends only on the fp type. It is *the* correct
> measure when you want "uniform" accuracy across the range of all floating
> point values. For instance, this is quite useful for special functions,
> whose range of values typically vary widely, but for which one still
> wants to have accuracy which is as good as possible.
Is nulp_diff exposed somewhere? It looks like a useful functions to
write nulp tests, and I only saw it in the source.
Josef
>
> --
> Pauli Virtanen
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list