Custom Division with lists - divide by zero
SetAttributes[division, Listable]
division[{1, 2, 0}, {0, 1, 2}]
{-1, 2, 0}
Another possibility is to use Block
:
division[a_, b_] := Quiet @ Block[{DirectedInfinity},
DirectedInfinity[]=-1;
Divide[a, b]
]
division[{1, 2, 0}, {0, 1, 2}]
{-1, 2, 0}