numbers: implement direct __abs__ & __neg__ for singletons where appropriate
commit184684e6d7fd17d9c94c19e011416c5b347e208e
authorKirill Smelkov <kirr@landau.phys.spbu.ru>
Sat, 9 Feb 2008 07:59:27 +0000 (9 10:59 +0300)
committerKirill Smelkov <kirr@landau.phys.spbu.ru>
Sat, 9 Feb 2008 07:59:27 +0000 (9 10:59 +0300)
tree94ef0fa0639ad61b02603e0a244e1eb5b129a100
parent7b5ca820229b833b7bf4d7c4f48a25261d3a90bf
numbers: implement direct __abs__ & __neg__ for singletons where appropriate

from operator import abs as abs_

        %timeit     %timeit     %timeit     ...
        abs_(pi)    -S.One        -oo

old:    36.1 µs     23.2 µs     22.2 µs
new:     2.7 µs      2.6 µs      2.4 µs
sympy/core/numbers.py