Not sure if more elegant, but removing zeros afterwards might be cheaper. Maybe not, though ;)
Btw, this code doesn't really solve the problem, right? If the dot product is equal to ``1e-9``, then you still get a sign of zero.