Fix buildbots errors introduced with the registration module

Most failures are caused because "__isinf" is not defined in Visual C. Here, I am using cimport from libc.math (the library provided by cython) instead of importing directly from math.h.
 And reasons why sigmasq can become infinite? Can you grab it before that happens?