imagep(): prevent problem if z contains +- Inf