Carefully define signbit & isfinite

Fixes #502