Compute differential correctly (not optimized)