Only change I did, adding condition at <code>UFUNC_CHECK_STATUS</code> as 
<pre>
#define UFUNC_CHECK_STATUS(ret) do { \
    int fpstatus = (int) fetestexcept(FE_DIVBYZERO | FE_OVERFLOW | \
                                          FE_UNDERFLOW | FE_INVALID); \
    if (fpstatus == 0) { \
       ret = 0;\
    } else { \
         ret =    ((FE_DIVBYZERO  & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
                | ((FE_OVERFLOW   & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
                | ((FE_UNDERFLOW  & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
                | ((FE_INVALID    & fpstatus) ? UFUNC_FPE_INVALID : 0); \  
    }\
} while (0)
</pre>

and separate out clear operations to <code>UFUNC_CLEAR_STATUS</code>
<pre>
#define UFUNC_CLEAR_STATUS() { \
        (void) feclearexcept(FE_DIVBYZERO | FE_OVERFLOW | \
                            FE_UNDERFLOW | FE_INVALID); \       
}</pre>

For all platform likewise. It doesn't include other error-object changes which I did in different pr #3686.