Improve zero checks in sparse and reduce

Just noticed some checks with `0` that don't play nice with custom types. There are probably more of these, but I'm not sure about a systematic way to find them.

This is only my second "real" commit, so not sure my test code is kosher style-wise.