Calculating residue at infinity

When I was computing the residue at infinity, I encountered a slight issue. The second method of computation is correct, resulting in -3/2. Why does directly using the first formula to calculate the residue at infinity not yield the correct function value?

The results seem correct to me, according to the definition of residue at infinity found on wikipedia

The change of variables w=1/z will give dw=-1/z^2 dz. Maybe that sign is what you were missing?