MAINT: optimize: clean up Zeros code

* Use standard C header file <math.h>
* Decouple implementation from interface in zeros.h
  (expanded out the ERROR macro for readability)
* Don't use static variables, they make code non-reentrant
  and hinder compiler optimizations
* Indentation, {}, split multi-statement lines
Merge pull request #4159 from larsmans/c-fixes

MAINT: optimize: clean up Zeros code