In this case I think it should be up to the user to check that he does not divide by 0.
There's not much we could do, so let the result be same as dividing two floats by 0 manually, i.e. float w = p.width/.0, h=p.height/.0