BUG: fix non-c99 fallback for np.inf input to log1p/expm1

closes gh-4225

backport for 1.8