-
-
Notifications
You must be signed in to change notification settings - Fork 641
Open
Description
Currently, comparisons involving infinities can be slow:
sage: %timeit 2 > oo # slow
4.96 µs ± 35.1 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
sage: %timeit oo > oo # ok
321 ns ± 4.57 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
sage: %timeit 1/2 > oo # slow
5.95 µs ± 311 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
sage: o = RR(oo)
sage: %timeit o > oo # slow
2.5 µs ± 26.8 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
It's probably a good idea to implement __richcmp__
for the infinity elements to special case a few of these obvious things.
CC: @roed314
Component: basic arithmetic
Issue created by migration from https://trac.sagemath.org/ticket/33337