We already have a relative tolerance check available:

sage: print("0.9999")    # rel tol 1e-4
1.0
sage: print("1.00001")   # abs tol 1e-5
1.0
David

On Thu, Dec 30, 2021 at 2:42 PM tobia...@gmx.de <tobiasd...@gmx.de> wrote:

> It would also be an idea to replace these absolute tolerance tests, i.e.
> abs(x - y) < something, by a relative tests abs(x-y)/x < something. In
> general, this should be more stable. Such an approach is used by pytest,
> see https://docs.pytest.org/en/6.2.x/reference.html#pytest-approx. Maybe
> this helper function could be directly re-used, which would also simplify
> comparing lists etc.
>
> On Thursday, December 30, 2021 at 7:18:11 AM UTC+1 Kwankyu Lee wrote:
>
>> On Thursday, December 30, 2021 at 8:40:35 AM UTC+9
>> dmo...@deductivepress.ca wrote:
>>
>>> In the long run, we want to fix the doctests so they always pass (as
>>> described in the previous comment).
>>>
>>> However, in the short run, I think it is fine to add
>>>
>>> set_random_seed(0)  # failed doctest - see  trac ticket nnnnn
>>>
>>
>> +1. So this is (B). The ticket nnnnn is cc'ed to the writer of the failed
>> doctests.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-devel/8717e8ca-820a-460f-aff6-299dfe97dca1n%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-devel/8717e8ca-820a-460f-aff6-299dfe97dca1n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAChs6_nXOETyhaU-mUwJB64NOpPEfhEM%2B0kZNK%3D7SYptAHVkcQ%40mail.gmail.com.

Reply via email to