test for Inf and -Inf instead of relying on method